using FrameworkDAL.DTO.EIPConversation; using System; using System.Collections.Generic; namespace FrameworkDAL.DTO.EIPConversation { /// /// Represents the context for sending a response via a channel (WhatsApp, Email, Postman, etc.) /// public class EIPResponseContext { #region Channel / Recipient / Message /// /// Channel name (e.g., WHATSAPP, EMAIL, POSTMAN) /// public string Channel { get; set; } = default!; /// /// Channel type enum /// public EIPChannelType ChannelType { get; set; } = EIPChannelType.PostMan; /// /// Recipient identifier (e.g., phone number, email) /// public string Recipient { get; set; } = default!; /// /// Message text /// public string Message { get; set; } = default!; /// Optional logical key into MEIPMESSAGETEMPLATE — when set and a matching /// row exists for (TenantId, MessageKey, LanguageCode, ChannelType), EIPResponseEngine /// overrides Message with the localized template content before sending. public string? MessageKey { get; set; } /// Skips the per-recipient anti-spam rate limit (2s cooldown, keyed by /// Channel:Recipient). The limiter exists to stop a runaway flow from spamming a /// user, but it has no concept of message importance -- a completely normal, /// fast back-to-back conversation turn (e.g. answering a prompt within 2s of the /// previous message) would otherwise silently drop the next send, including a /// security-critical OTP code. Set true only for messages that must never be /// silently dropped (currently: OTP delivery). public bool BypassRateLimit { get; set; } /// /// Optional interactive buttons /// public List? Buttons { get; set; } /// /// Optional media URL /// public string? MediaUrl { get; set; } /// /// Media type (image, video, document, etc.) /// public string? MediaType { get; set; } /// /// Optional caption for media /// public string? Caption { get; set; } #endregion #region Flow / Tenant / User /// /// Tenant Id /// public int? TenantId { get; set; } /// /// Flow code (can be string or enum) /// public object FlowCode { get; set; } = default!; /// /// User identifier (phone, email, etc.) /// public string? UserIdentifier { get; set; } /// /// Raw payload or object triggering this context /// public object? RawPayload { get; set; } #endregion #region WhatsApp Template Support /// /// Template name for WhatsApp messages /// public string? TemplateName { get; set; } /// /// Language code for template (e.g., en_US) /// public string? LanguageCode { get; set; } /// /// Template components (buttons, headers, body params) /// public List? TemplateComponents { get; set; } #endregion #region Metadata & Trace /// /// Additional metadata to attach to this message context /// public Dictionary? Metadata { get; set; } /// /// Execution trace of different phases /// public List? PhaseTrace { get; set; } #endregion #region Conversation Context /// /// Optional conversation id /// public long? ConversationId { get; set; } /// /// Current step in the flow /// public string? CurrentStepCode { get; set; } /// /// Next step in the flow /// public string? NextStepCode { get; set; } /// /// Whether the current flow/step is completed /// public bool? IsCompleted { get; set; } /// /// Whether the current operation succeeded /// public bool? IsSuccess { get; set; } /// /// Error message if any /// public string? ErrorMessage { get; set; } /// /// Response received from the channel /// public EIPChannelResponseDTO? ChannelResponse { get; set; } #endregion #region Additional Dynamic Info /// /// Any additional dynamic data to attach to this context /// public Dictionary? AdditionalData { get; set; } #endregion #region Structured Response Data /// /// Populated when a CALL_API or PRESENT step has ResponseFormat configured. /// Text-only channels (WhatsApp, SMS) call EIPTextFormatter.FormatAsText() to produce /// a plain-text fallback; rich channels (AppChat) render TABLE/CARD/LIST natively. /// public EIPStructuredDataDTO? StructuredData { get; set; } #endregion #region Extended Interaction /// QR code data string — channels encode and deliver as QR image or raw text. public string? QrCodeData { get; set; } /// When true, the channel should render a location-share prompt/button. public bool RequestLocation { get; set; } /// /// For outbound map pin messages (WhatsApp/Telegram support sending a location). /// Channel handlers build the appropriate location payload from this. /// public EIPLocationDTO? LocationPin { get; set; } /// /// Input type hint for the next expected user reply. /// AppChat uses this to show the right widget. Text-only channels ignore it. /// public string? InputHint { get; set; } /// Max star value when InputHint="rating". public int? RatingMax { get; set; } /// SSML or plain-text TTS override for Voice channel. public string? VoiceHint { get; set; } #endregion } }