namespace FrameworkDAL.DTO.EventRule
{
///
/// Flat projection combining MACTION + MEVENTTYPEACTION + MEVENTTYPEACTIONDETAIL.
/// Used for both read and write operations via the EventRule CRUD module.
///
/// ActionType values:
/// 0 = Email, 1 = SMS, 2 = Webhook, 3 = Notification, 4 = Report
///
/// ToDeliveryType / MailCcDeliveryType / MailBccDeliveryType:
/// 3 = direct email address, 2 = field name in entity payload, 1 = mail list
///
public sealed class EventRuleDTO
{
// ── MACTION fields ────────────────────────────────────────────────────
public int ActionId { get; set; }
public string? ActionName { get; set; }
/// 0=Email, 1=SMS, 2=Webhook, 3=Notification, 4=Report
public int ActionType { get; set; }
public string? SendTo { get; set; }
public int ToDeliveryType { get; set; }
public string? ReplyTo { get; set; }
public int TemplateId { get; set; }
public string? MailCc { get; set; }
public int MailCcDeliveryType { get; set; }
public string? MailBcc { get; set; }
public int MailBccDeliveryType { get; set; }
public int WebServiceId { get; set; }
public string? UriParameterValue { get; set; }
public int ReportId { get; set; }
public int Status { get; set; } = 1;
///
/// Optional condition. Format: "LHS operator RHS" e.g. "Payload.Amount > 100000".
/// Null/empty = always trigger. Validated by IConditionEvaluator before save.
///
public string? ConditionExpression { get; set; }
// ── MEVENTTYPEACTION + MEVENTTYPEACTIONDETAIL fields ──────────────────
/// EventTypeId this action is bound to (MEVENTTYPEACTION.EVENTTYPEID).
public int EventTypeId { get; set; }
/// Display order in MEVENTTYPEACTIONDETAIL.SLNO.
public short SlNo { get; set; } = 9999;
// ── Read-only display fields ─────────────────────────────────────────
public string? EventTypeName { get; set; }
public string? EventTypeCode { get; set; }
// ── Audit fields ──────────────────────────────────────────────────────
public int CreatedById { get; set; }
public int ModifiedById { get; set; }
}
}