using MediatR;
using WhatsAppService.Domain.AggregatesModel.ConversationAggregate;

namespace WhatsAppService.Domain.Events;

/// <summary>
/// EN: Domain event raised when a message is received in a conversation.
/// VI: Domain event được phát ra khi nhận được tin nhắn trong conversation.
/// </summary>
public class MessageReceivedEvent : INotification
{
    /// <summary>
    /// EN: The conversation ID.
    /// VI: ID của conversation.
    /// </summary>
    public Guid ConversationId { get; }

    /// <summary>
    /// EN: The message ID.
    /// VI: ID của tin nhắn.
    /// </summary>
    public Guid MessageId { get; }

    /// <summary>
    /// EN: The shop ID.
    /// VI: ID của shop.
    /// </summary>
    public Guid ShopId { get; }

    /// <summary>
    /// EN: The customer's WhatsApp ID.
    /// VI: WhatsApp ID của khách hàng.
    /// </summary>
    public string CustomerWaId { get; }

    /// <summary>
    /// EN: The message content.
    /// VI: Nội dung tin nhắn.
    /// </summary>
    public MessageContent Content { get; }

    /// <summary>
    /// EN: The timestamp when message was received.
    /// VI: Thời điểm nhận tin nhắn.
    /// </summary>
    public DateTime ReceivedAt { get; }

    public MessageReceivedEvent(Guid conversationId, Guid messageId, Guid shopId, string customerWaId, MessageContent content)
    {
        ConversationId = conversationId;
        MessageId = messageId;
        ShopId = shopId;
        CustomerWaId = customerWaId;
        Content = content;
        ReceivedAt = DateTime.UtcNow;
    }
}
