using System.Collections.Generic; using System.Text.Json.Serialization; namespace FrameworkDAL.DTO.EIPConversation { public class EIPFlowStepDTO { public string StepCode { get; set; } = string.Empty; // MESSAGE | PROMPT | INPUT | CONDITION | CONDITIONAL | CAPABILITY | ACTION | CHOICE | EXTERNAL_ACTION | END public string StepType { get; set; } = string.Empty; public string? NextStepCode { get; set; } // ── Message rendering ────────────────────────────────────────────── public string? MessageTemplate { get; set; } /// Optional logical key into MEIPMESSAGETEMPLATE (TenantId, MessageKey, /// LanguageCode, ChannelType) — when set and a matching row exists, EIPResponseEngine /// uses the localized template instead of MessageTemplate. Falls back to MessageTemplate /// when unset or no row matches, so existing flow-JSON-authored messages are unaffected. public string? MessageKey { get; set; } // ── Capability (Phase 4) ─────────────────────────────────────────── public string? CapabilityCode { get; set; } // ── ACTION step — CALL_API / TRIGGER_MESSAGEHUB / DB_UPDATE ─────── public string? ActionType { get; set; } // For CALL_API: endpoint configuration public EIPApiConfig? ApiConfig { get; set; } // For TRIGGER_MESSAGEHUB: which entity template to trigger public int EntityId { get; set; } // Key in session context to store the API response public string? ContextKey { get; set; } // ── INPUT step — collect and validate user input ─────────────────── public EIPStepValidation? Validation { get; set; } // ── CONDITIONAL step — multi-branch on context value ─────────────── public string? ConditionKey { get; set; } public List? Conditions { get; set; } public string? DefaultNextStepCode { get; set; } // ── CHOICE step — menu-driven branching ─────────────────────────── // Key = option label shown to user, Value = NextStepCode public Dictionary? Choices { get; set; } // ── EXTERNAL_ACTION step — button-press decision map ─────────────── // (kept for backward compatibility with Mode 1 flows) public Dictionary? DecisionMap { get; set; } // ── Legacy condition expression (CONDITION step) ─────────────────── public string? ConditionExpression { get; set; } // ── Terminal flag ────────────────────────────────────────────────── public bool IsTerminal { get; set; } = false; // ── Response presentation (CALL_API / PRESENT steps) ───────────── /// /// Declares how the API response should be parsed and structured for channel rendering. /// When set on a CALL_API step, the engine builds EIPStructuredDataDTO after the HTTP call. /// When set on a PRESENT step, the engine reads context.Variables[ContextKey] and builds it. /// Null (or Type=TEXT) means pass raw string through ResponseMessage only. /// public EIPResponseFormatDTO? ResponseFormat { get; set; } // ── QUALIFY step — GOP Qualifier + optional Mapper ──────────────── public EIPQualifyConfigDTO? QualifyConfig { get; set; } // ── ENRICH step — GOP Mapper only ───────────────────────────────── public EIPEnrichConfigDTO? EnrichConfig { get; set; } // ── DYNAMIC_CHOICE step — choices from a stored API result ──────── public EIPDynamicChoiceConfigDTO? DynamicChoiceConfig { get; set; } // ── QR code display (any step that returns a response) ──────────── /// /// When set, the response includes a QR code encoding this string. /// Supports {VarKey} substitution. AppChat renders natively; other channels /// convert to a QR image URL via the configured QR service. /// public string? QrCodeData { get; set; } // ── Voice hint (MESSAGE/ACTION steps on Voice channel) ──────────── /// SSML markup or plain-text TTS override. Used by VoiceChannelHandler. public string? VoiceHint { get; set; } // ── LINK step — send URL buttons without capturing a reply ──────── public List? LinkButtons { get; set; } // ── Actions list (future extensibility) ─────────────────────────── public List? Actions { get; set; } public int? RetryCount { get; set; } public Dictionary? Metadata { get; set; } } /// A URL button for LINK steps — tapping opens the URL without a conversation reply. public class EIPLinkButtonDTO { public string Title { get; set; } = ""; public string Url { get; set; } = ""; } public class EIPApiConfig { // ── Existing (backward-compatible) ───────────────────────────────── /// Full URL. Used when ServicePrefix is null. Supports {VarName} substitution. public string? Url { get; set; } public string Method { get; set; } = "GET"; public Dictionary? Headers { get; set; } /// JSON body template with {VarName} substitution. Used when Parameters is null. public string? BodyTemplate { get; set; } // ── New: YARP-routed internal GB5 calls ──────────────────────────── /// /// YARP gateway prefix (e.g., "mms", "fws", "prs"). /// When set, URL = login.BaseUri / ServicePrefix / PathTemplate. /// The YARP gateway strips the prefix and routes to the correct microservice. /// public string? ServicePrefix { get; set; } /// /// Path relative to the service prefix. Supports {VarName} substitution. /// Example: "/MMHead/SaveMMHead" or "/Leave/GetLeave/{LeaveId}" /// public string? PathTemplate { get; set; } // ── New: structured parameter definitions ────────────────────────── /// /// When populated, replaces BodyTemplate. Parameters are split into body, query, /// header, or path targets based on their In field, and values are resolved from /// FIXED literals, CONTEXT variables, or user INPUT collected in prior steps. /// public List? Parameters { get; set; } } public class EIPStepValidation { public bool Required { get; set; } public string? Regex { get; set; } public string? ErrorMessage { get; set; } /// /// Input modality hint and server-side validation type. /// "text" (default) | "number" | "date" | "email" | "phone" | "qr_scan" | "file" | "rating" /// AppChat uses this to render the appropriate UI widget (date picker, camera, star rating, etc.). /// text-only channels always receive text; server validates format for number/date/email/phone/rating. /// public string InputType { get; set; } = "text"; /// Maximum star value for InputType="rating". Default 5. public int? RatingMax { get; set; } /// Comma-separated accepted MIME types for InputType="file" (e.g. "image/jpeg,application/pdf"). public string? AllowedFileTypes { get; set; } } public class EIPStepCondition { // EXISTS | NOT_EXISTS | EQUALS | NOT_EQUALS | IN | GT | LT public string Operator { get; set; } = string.Empty; public string? Value { get; set; } public List? Values { get; set; } public string NextStepCode { get; set; } = string.Empty; } public class EIPFlowActionDTO { public string ActionType { get; set; } = string.Empty; public Dictionary? Config { get; set; } } }