using FacebookService.Domain.SeedWork;

namespace FacebookService.Domain.AggregatesModel.ConversationAggregate;

/// <summary>
/// EN: Repository interface for Conversation aggregate.
/// VI: Interface repository cho Conversation aggregate.
/// </summary>
public interface IConversationRepository : IRepository<Conversation>
{
    /// <summary>
    /// EN: Get conversation by ID with messages.
    /// VI: Lấy conversation theo ID với tin nhắn.
    /// </summary>
    Task<Conversation?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get conversation by ID including all messages.
    /// VI: Lấy conversation theo ID bao gồm tất cả tin nhắn.
    /// </summary>
    Task<Conversation?> GetByIdWithMessagesAsync(Guid id, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Find active conversation for a customer on a page.
    /// VI: Tìm conversation đang hoạt động cho khách hàng trên một trang.
    /// </summary>
    Task<Conversation?> FindActiveByCustomerAndPageAsync(
        Guid customerId, 
        string pageId, 
        CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get all conversations for a customer.
    /// VI: Lấy tất cả conversations của một khách hàng.
    /// </summary>
    Task<IReadOnlyList<Conversation>> GetByCustomerIdAsync(
        Guid customerId, 
        CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Add a new conversation.
    /// VI: Thêm conversation mới.
    /// </summary>
    Conversation Add(Conversation conversation);

    /// <summary>
    /// EN: Update an existing conversation.
    /// VI: Cập nhật conversation hiện có.
    /// </summary>
    void Update(Conversation conversation);
}
