// EN: Merchant repository interface.
// VI: Interface repository cho Merchant.

using MerchantService.Domain.SeedWork;

namespace MerchantService.Domain.AggregatesModel.MerchantAggregate;

/// <summary>
/// EN: Repository interface for Merchant aggregate.
/// VI: Interface repository cho Merchant aggregate.
/// </summary>
public interface IMerchantRepository : IRepository<Merchant>
{
    /// <summary>
    /// EN: Get merchant by ID.
    /// VI: Lấy merchant theo ID.
    /// </summary>
    Task<Merchant?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// EN: Get merchant by user ID (IAM User).
    /// VI: Lấy merchant theo user ID (IAM User).
    /// </summary>
    Task<Merchant?> GetByUserIdAsync(Guid userId, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// EN: Check if user already has a merchant account.
    /// VI: Kiểm tra user đã có tài khoản merchant chưa.
    /// </summary>
    Task<bool> ExistsByUserIdAsync(Guid userId, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// EN: Get all merchants with pagination.
    /// VI: Lấy tất cả merchants với phân trang.
    /// </summary>
    Task<IReadOnlyList<Merchant>> GetAllAsync(int pageNumber, int pageSize, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// EN: Get merchants by status.
    /// VI: Lấy merchants theo trạng thái.
    /// </summary>
    Task<IReadOnlyList<Merchant>> GetByStatusAsync(MerchantStatus status, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// EN: Add a new merchant.
    /// VI: Thêm merchant mới.
    /// </summary>
    Merchant Add(Merchant merchant);
    
    /// <summary>
    /// EN: Update a merchant.
    /// VI: Cập nhật merchant.
    /// </summary>
    void Update(Merchant merchant);
}
