using MediatR;

namespace MembershipService.API.Application.Commands;

/// <summary>
/// EN: Command to add experience points to a member.
/// VI: Command để thêm điểm kinh nghiệm cho member.
/// </summary>
public class AddExperienceCommand : IRequest<AddExperienceResult>
{
    /// <summary>
    /// EN: Member ID.
    /// VI: ID của member.
    /// </summary>
    public Guid MemberId { get; set; }

    /// <summary>
    /// EN: Amount of EXP points to add.
    /// VI: Số điểm EXP cộng thêm.
    /// </summary>
    public int Points { get; set; }

    /// <summary>
    /// EN: Source of experience (1=Purchase, 2=Referral, 3=Activity, 4=Promotion, 5=Review, 6=CheckIn, 7=Admin).
    /// VI: Nguồn EXP (1=Mua hàng, 2=Giới thiệu, 3=Hoạt động, 4=Khuyến mãi, 5=Đánh giá, 6=Check-in, 7=Admin).
    /// </summary>
    public int SourceId { get; set; }

    /// <summary>
    /// EN: Reference ID (Order ID, Referral Code, etc.).
    /// VI: ID tham chiếu (Order ID, Referral Code, etc.).
    /// </summary>
    public string? ReferenceId { get; set; }

    /// <summary>
    /// EN: Additional metadata as JSON string.
    /// VI: Metadata bổ sung dạng chuỗi JSON.
    /// </summary>
    public string? Metadata { get; set; }
}

/// <summary>
/// EN: Result of add experience command.
/// VI: Kết quả của add experience command.
/// </summary>
public class AddExperienceResult
{
    /// <summary>
    /// EN: Member ID.
    /// VI: ID của member.
    /// </summary>
    public Guid MemberId { get; set; }

    /// <summary>
    /// EN: Points added.
    /// VI: Điểm đã thêm.
    /// </summary>
    public int PointsAdded { get; set; }

    /// <summary>
    /// EN: New current EXP.
    /// VI: EXP hiện tại mới.
    /// </summary>
    public int CurrentExp { get; set; }

    /// <summary>
    /// EN: Total EXP earned.
    /// VI: Tổng EXP đã kiếm được.
    /// </summary>
    public int TotalExpEarned { get; set; }

    /// <summary>
    /// EN: Previous level before adding EXP.
    /// VI: Level trước khi thêm EXP.
    /// </summary>
    public int PreviousLevel { get; set; }

    /// <summary>
    /// EN: Current level after adding EXP.
    /// VI: Level hiện tại sau khi thêm EXP.
    /// </summary>
    public int CurrentLevel { get; set; }

    /// <summary>
    /// EN: Whether the member leveled up.
    /// VI: Member có lên level không.
    /// </summary>
    public bool LeveledUp { get; set; }

    /// <summary>
    /// EN: Experience transaction ID.
    /// VI: ID của experience transaction.
    /// </summary>
    public Guid TransactionId { get; set; }
}
