using FrameworkDAL.DTO.EIPConversation; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace FrameworkSL.Hubs.EIPChat { // ============================================================ // IEIPChatClient — strongly-typed client contract for EIPChatHub. // // All client-side methods the server can invoke are declared here. // Using Hub gives compile-time verification of // every method name and parameter type. // ============================================================ public interface IEIPChatClient { /// /// Delivers a bot response to the connected client. /// Fired after each successful conversation turn. /// Task ReceiveBotMessage(EIPChatMessageDTO message); /// /// Delivers an error notification to the connected client. /// Task ReceiveError(string errorMessage); /// /// Delivers a typing-indicator update so the UI can show "bot is typing…". /// Task ReceiveTypingIndicator(bool isTyping); } // DTO shared between hub and client — kept in the same file // since it is a thin transport model with no business logic. public class EIPChatMessageDTO { public string? Message { get; set; } public string? CurrentStepCode { get; set; } public string? NextStepCode { get; set; } public bool IsCompleted { get; set; } /// /// Populated for CHOICE steps so the UI can render option buttons. /// Key = display label, Value = choice value to send back. /// public Dictionary? Choices { get; set; } /// /// Populated when a CALL_API or PRESENT step has ResponseFormat configured. /// The frontend renders TABLE as an HTML table, CARD as key-value pairs, LIST as an ordered list. /// When null, render Message as plain text only. /// public EIPStructuredDataDTO? StructuredData { get; set; } /// QR code data — frontend renders a QR canvas when set. public string? QrCodeData { get; set; } /// /// Input widget hint for the reply box: /// "text"|"number"|"date"|"email"|"phone"|"qr_scan"|"file"|"rating"|"location" /// public string? InputHint { get; set; } /// Max stars when InputHint="rating". public int? RatingMax { get; set; } /// When true, frontend should trigger HTML5 Geolocation and send coordinates back. public bool RequestLocation { get; set; } /// /// Interactive reply buttons from CHOICE or DYNAMIC_CHOICE steps. /// Frontend renders these as clickable buttons; clicking sends the Payload value back as a message. /// public List? Buttons { get; set; } public DateTime SentAtUtc { get; set; } = DateTime.UtcNow; } }