using MediatR;

namespace MembershipService.API.Application.Queries;

/// <summary>
/// EN: Query to get experience history for a member.
/// VI: Query để lấy lịch sử EXP của member.
/// </summary>
public class GetExperienceHistoryQuery : IRequest<ExperienceHistoryResult>
{
    public Guid MemberId { get; set; }
    public int PageIndex { get; set; } = 0;
    public int PageSize { get; set; } = 20;

    public GetExperienceHistoryQuery(Guid memberId, int pageIndex = 0, int pageSize = 20)
    {
        MemberId = memberId;
        PageIndex = pageIndex;
        PageSize = pageSize;
    }
}

/// <summary>
/// EN: Experience history result.
/// VI: Kết quả lịch sử EXP.
/// </summary>
public class ExperienceHistoryResult
{
    public IEnumerable<ExperienceTransactionDto> Transactions { get; set; } = Enumerable.Empty<ExperienceTransactionDto>();
    public int TotalCount { get; set; }
    public int PageIndex { get; set; }
    public int PageSize { get; set; }
}

/// <summary>
/// EN: Experience transaction DTO.
/// VI: DTO giao dịch EXP.
/// </summary>
public class ExperienceTransactionDto
{
    /// <summary>
    /// EN: Transaction ID.
    /// VI: ID giao dịch.
    /// </summary>
    public Guid Id { get; set; }

    /// <summary>
    /// EN: Points earned.
    /// VI: Điểm kiếm được.
    /// </summary>
    public int Points { get; set; }

    /// <summary>
    /// EN: Source name.
    /// VI: Tên nguồn.
    /// </summary>
    public string Source { get; set; } = null!;

    /// <summary>
    /// EN: Source ID.
    /// VI: ID nguồn.
    /// </summary>
    public int SourceId { get; set; }

    /// <summary>
    /// EN: Reference ID.
    /// VI: ID tham chiếu.
    /// </summary>
    public string? ReferenceId { get; set; }

    /// <summary>
    /// EN: Level at time of transaction.
    /// VI: Level tại thời điểm giao dịch.
    /// </summary>
    public int LevelAtTime { get; set; }

    /// <summary>
    /// EN: Creation timestamp.
    /// VI: Thời gian tạo.
    /// </summary>
    public DateTime CreatedAt { get; set; }
}
