using MediatR;

namespace MissionService.API.Application.Queries;

/// <summary>
/// EN: Query to get user's check-in status
/// VI: Query lấy trạng thái check-in của user
/// </summary>
public record GetCheckInStatusQuery(Guid UserId) : IRequest<CheckInStatusResult>;

/// <summary>
/// EN: Query to get check-in history for a month
/// VI: Query lấy lịch sử check-in trong tháng
/// </summary>
public record GetCheckInHistoryQuery(Guid UserId, int Year, int Month) : IRequest<CheckInHistoryResult>;

/// <summary>
/// EN: Query to get check-in leaderboard
/// VI: Query lấy bảng xếp hạng check-in
/// </summary>
public record GetCheckInLeaderboardQuery(int Count = 10) : IRequest<CheckInLeaderboardResult>;

/// <summary>
/// EN: Check-in status result DTO
/// VI: DTO kết quả trạng thái check-in
/// </summary>
public record CheckInStatusResult(
    int CurrentStreak,
    int LongestStreak,
    int TotalCheckIns,
    DateOnly? LastCheckInDate,
    bool CanCheckInToday,
    StreakRewardPreview? NextReward);

/// <summary>
/// EN: Streak reward preview
/// VI: Xem trước phần thưởng streak
/// </summary>
public record StreakRewardPreview(
    int NextMilestone,
    int DaysToMilestone,
    decimal DailyPoints,
    decimal MilestoneBonus);

/// <summary>
/// EN: Check-in history result DTO
/// VI: DTO kết quả lịch sử check-in
/// </summary>
public record CheckInHistoryResult(
    int Year,
    int Month,
    IReadOnlyList<CheckInDayDto> Days);

/// <summary>
/// EN: Single check-in day DTO
/// VI: DTO ngày check-in đơn lẻ
/// </summary>
public record CheckInDayDto(
    DateOnly Date,
    decimal PointsEarned,
    bool IsMilestone,
    int StreakOnDay);

/// <summary>
/// EN: Check-in leaderboard result
/// VI: Kết quả bảng xếp hạng check-in
/// </summary>
public record CheckInLeaderboardResult(IReadOnlyList<LeaderboardEntry> Entries);

/// <summary>
/// EN: Leaderboard entry
/// VI: Mục trong bảng xếp hạng
/// </summary>
public record LeaderboardEntry(
    int Rank,
    Guid UserId,
    int CurrentStreak,
    int LongestStreak,
    int TotalCheckIns);
