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

namespace WhatsAppService.Domain.Events;

/// <summary>
/// EN: Domain event raised when a conversation is closed.
/// VI: Domain event được phát ra khi conversation được đóng.
/// </summary>
public class ConversationClosedEvent : INotification
{
    /// <summary>
    /// EN: The conversation ID.
    /// VI: ID của conversation.
    /// </summary>
    public Guid ConversationId { 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 closing status (Closed or Expired).
    /// VI: Trạng thái đóng (Closed hoặc Expired).
    /// </summary>
    public ConversationStatus ClosingStatus { get; }

    /// <summary>
    /// EN: The timestamp when conversation was closed.
    /// VI: Thời điểm conversation được đóng.
    /// </summary>
    public DateTime ClosedAt { get; }

    /// <summary>
    /// EN: Total message count in the conversation.
    /// VI: Tổng số tin nhắn trong conversation.
    /// </summary>
    public int MessageCount { get; }

    public ConversationClosedEvent(
        Guid conversationId,
        Guid shopId,
        string customerWaId,
        ConversationStatus closingStatus,
        int messageCount)
    {
        ConversationId = conversationId;
        ShopId = shopId;
        CustomerWaId = customerWaId;
        ClosingStatus = closingStatus;
        MessageCount = messageCount;
        ClosedAt = DateTime.UtcNow;
    }
}
