namespace FrameworkDAL.DTO.EventSub
{
///
/// Projection from MACTION used by EventSubDAL.
/// Contains only the fields needed to build an ActionEventDto and queue it.
///
/// DeliveryType values (TODELIVERYTYPE / MAILCCDELIVERYTYPE / MAILBCCDELIVERYTYPE):
/// 3 = direct email address (use value as-is)
/// 2 = field name — resolve from entity payload at send time
/// 1 = mail list
/// 12 = EnrichQualifier — SENDTO holds a MGBCONFIGUREDQUERY QueryCode; run it to get the email
///
/// ToContentType — relevant only when DeliveryType = 2 (Content):
/// 0=Direct, 1=Employee, 2=Party, 3=User, 4=Contact, 5=UserGroup, 6=Role
///
public class EventSubActionDTO
{
public int ActionId { get; set; }
/// 0=Email, 1=SMS, 2=Webhook, 3=Notification, 4=Report
public int ActionType { get; set; }
public string? SendTo { get; set; }
/// 3=direct email, 2=field name in payload, 1=mail list, 12=EnrichQualifier
public int ToDeliveryType { get; set; }
/// 0=Direct, 1=Employee, 2=Party, 3=User, 4=Contact, 5=UserGroup, 6=Role. Active when DeliveryType=2.
public int ToContentType { get; set; }
public string? ReplyTo { get; set; }
public int TemplateId { get; set; }
public string? MailCc { get; set; }
/// 3=direct email, 2=field name in payload, 1=mail list, 12=EnrichQualifier
public int MailCcDeliveryType { get; set; }
public string? MailBcc { get; set; }
/// 3=direct email, 2=field name in payload, 1=mail list, 12=EnrichQualifier
public int MailBccDeliveryType { get; set; }
public int WebServiceId { get; set; }
public string? UriParameterValue { get; set; }
public int ReportId { get; set; }
///
/// Optional condition expression evaluated before queueing this action.
/// Format: "LHS operator RHS" e.g. "Payload.Amount > 100000" or "ObjectTypeId == 5".
/// Null/empty = always trigger. Evaluated by .
/// Stored in MACTION.CONDITIONEXPRESSION (added via AuditChangeTracking_Tables.sql migration).
///
public string? ConditionExpression { get; set; }
/// FK to MDIRECTACTION. -1 = no interactive buttons (one-way notification).
public int DirectActionId { get; set; } = -1;
}
}