using MembershipService.Domain.SeedWork;

namespace MembershipService.Domain.AggregatesModel.MemberAggregate;

/// <summary>
/// EN: Repository interface for Member aggregate.
/// VI: Giao diện repository cho Member aggregate.
/// </summary>
public interface IMemberRepository : IRepository<Member>
{
    /// <summary>
    /// EN: Get member by ID.
    /// VI: Lấy member theo ID.
    /// </summary>
    Task<Member?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get member by User ID (from IAM Service).
    /// VI: Lấy member theo User ID (từ IAM Service).
    /// </summary>
    Task<Member?> GetByUserIdAsync(Guid userId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get paginated list of members.
    /// VI: Lấy danh sách members có phân trang.
    /// </summary>
    Task<(IEnumerable<Member> Members, int TotalCount)> GetPaginatedAsync(
        int pageIndex,
        int pageSize,
        string? searchTerm = null,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Check if member exists for given user ID.
    /// VI: Kiểm tra xem member có tồn tại cho user ID cho trước không.
    /// </summary>
    Task<bool> ExistsForUserAsync(Guid userId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Add new member.
    /// VI: Thêm member mới.
    /// </summary>
    Member Add(Member member);

    /// <summary>
    /// EN: Update existing member.
    /// VI: Cập nhật member hiện tại.
    /// </summary>
    void Update(Member member);

    /// <summary>
    /// EN: Delete member.
    /// VI: Xóa member.
    /// </summary>
    void Delete(Member member);
}
