using MembershipService.Domain.SeedWork;

namespace MembershipService.Domain.AggregatesModel.ExperienceAggregate;

/// <summary>
/// EN: Repository interface for ExperienceTransaction.
/// VI: Interface repository cho ExperienceTransaction.
/// </summary>
/// <remarks>
/// EN: ExperienceTransaction is not an aggregate root, it belongs to Member aggregate.
/// This repository is for convenience of querying transactions.
/// VI: ExperienceTransaction không phải aggregate root, nó thuộc Member aggregate.
/// Repository này để tiện truy vấn transactions.
/// </remarks>
public interface IExperienceTransactionRepository
{
    /// <summary>
    /// EN: The unit of work for this repository.
    /// VI: Unit of work cho repository này.
    /// </summary>
    IUnitOfWork UnitOfWork { get; }

    /// <summary>
    /// EN: Get experience transaction by ID.
    /// VI: Lấy experience transaction theo ID.
    /// </summary>
    Task<ExperienceTransaction?> GetAsync(Guid id);

    /// <summary>
    /// EN: Get paginated experience transactions for a member.
    /// VI: Lấy experience transactions phân trang cho một member.
    /// </summary>
    Task<IReadOnlyList<ExperienceTransaction>> GetByMemberIdAsync(
        Guid memberId, 
        int skip = 0, 
        int take = 20);

    /// <summary>
    /// EN: Get experience transactions by source for a member.
    /// VI: Lấy experience transactions theo nguồn cho một member.
    /// </summary>
    Task<IReadOnlyList<ExperienceTransaction>> GetBySourceAsync(
        Guid memberId, 
        ExperienceSource source);

    /// <summary>
    /// EN: Get total EXP points for a member.
    /// VI: Lấy tổng điểm EXP của một member.
    /// </summary>
    Task<int> GetTotalPointsByMemberIdAsync(Guid memberId);

    /// <summary>
    /// EN: Get total EXP points by source for a member.
    /// VI: Lấy tổng điểm EXP theo nguồn cho một member.
    /// </summary>
    Task<int> GetTotalPointsBySourceAsync(Guid memberId, ExperienceSource source);

    /// <summary>
    /// EN: Get transaction count for a member.
    /// VI: Lấy số lượng transactions của một member.
    /// </summary>
    Task<int> GetCountByMemberIdAsync(Guid memberId);

    /// <summary>
    /// EN: Add new experience transaction.
    /// VI: Thêm experience transaction mới.
    /// </summary>
    ExperienceTransaction Add(ExperienceTransaction transaction);
}
