using MediatR;
using FacebookService.API.Application.Dtos;

namespace FacebookService.API.Application.Commands;

/// <summary>
/// EN: Command to process an incoming message from Facebook Messenger.
/// VI: Command để xử lý tin nhắn đến từ Facebook Messenger.
/// </summary>
/// <param name="PageId">EN: Facebook Page ID / VI: ID trang Facebook</param>
/// <param name="SenderId">EN: Facebook sender (user) ID / VI: ID người gửi Facebook</param>
/// <param name="MessageText">EN: Message content / VI: Nội dung tin nhắn</param>
/// <param name="FacebookMessageId">EN: Facebook message ID (mid) / VI: ID tin nhắn Facebook</param>
/// <param name="Timestamp">EN: Message timestamp / VI: Thời gian tin nhắn</param>
/// <param name="QuickReplyPayload">EN: Quick reply payload if any / VI: Payload quick reply nếu có</param>
public record ProcessIncomingMessageCommand(
    string PageId,
    string SenderId,
    string MessageText,
    string? FacebookMessageId = null,
    long? Timestamp = null,
    string? QuickReplyPayload = null
) : IRequest<ProcessIncomingMessageResult>;

/// <summary>
/// EN: Result of ProcessIncomingMessageCommand.
/// VI: Kết quả của ProcessIncomingMessageCommand.
/// </summary>
public record ProcessIncomingMessageResult(
    Guid ConversationId,
    Guid CustomerId,
    Guid MessageId,
    bool IsNewConversation,
    bool IsNewCustomer
);
