namespace SicboSub.Api.DTO
{
    /// <summary>
    /// Request model for loading play history
    /// </summary>
    public class PlayHistoryReq
    {
        public string msisdn { get; set; } = null!;
        public string? lang { get; set; }
        // Token passed in header
        public string? fromDate { get; set; }
        public string? toDate { get; set; }
        public int pageNumber { get; set; } = 0;
        public int pageSize { get; set; } = 20;
    }

    /// <summary>
    /// Response model for play history item
    /// </summary>
    public class PlayHistoryItem
    {
        // From BettingHistory
        public decimal id { get; set; }
        public decimal roomId { get; set; }
        public decimal bettingType { get; set; }
        public decimal bettingValue { get; set; }
        public DateTime bettingTime { get; set; }

        // From RoomPrize
        public decimal winCoin { get; set; }
        public decimal backCoin { get; set; }
        
        // Calculated
        public bool isWin { get; set; }
    }

    /// <summary>
    /// Request model for loading ranking prize history
    /// </summary>
    public class RankingHistoryReq
    {
        public string? msisdn { get; set; }
        public string? lang { get; set; }
        // Token passed in header
        
        /// <summary>
        /// Optional: DAILY or MONTHLY. If null, return both.
        /// </summary>
        public string? rankType { get; set; } 
        
        public string? fromDate { get; set; }
        public string? toDate { get; set; }
        public int pageNumber { get; set; } = 0;
        public int pageSize { get; set; } = 20;

        /// <summary>
        /// Optional flag to load directly from RankingHistory without RewardLogs
        /// </summary>
        public bool? onlyRanking { get; set; }

    }

    /// <summary>
    /// Response model for ranking prize history
    /// </summary>
    public class RankingHistoryItem
    {
        public decimal id { get; set; }
        public string msisdn { get; set; } // Added field
        public string rankType { get; set; } = null!; // DAILY, MONTHLY
        public DateTime rankDate { get; set; }
        public decimal rankPosition { get; set; }
        public decimal rewardValue { get; set; }
        public string rewardUnit { get; set; } = null!;
        public DateTime rewardDate { get; set; }
        public decimal totalBetValue { get; set; }
    }

    /// <summary>
    /// Request model for loading purchase history
    /// </summary>
    public class PurchaseHistoryReq
    {
        public string msisdn { get; set; } = null!;
        public string? lang { get; set; }
        public string? fromDate { get; set; }
        public string? toDate { get; set; }
        public int pageNumber { get; set; } = 0;
        public int pageSize { get; set; } = 20;
    }

    /// <summary>
    /// Response model for purchase history item (from REGINFO)
    /// </summary>
    public class PurchaseHistoryItem
    {
        public decimal id { get; set; }
        public string productName { get; set; } = null!;
        public DateTime registerTime { get; set; }
        public DateTime expireTime { get; set; }
        public decimal serviceId { get; set; } // Fee
        public string channel { get; set; } = null!;
        public byte status { get; set; }
        public int renew { get; set; }
        public int fee { get; set; }
    }

    /// <summary>
    /// Request model for loading exchange configuration
    /// </summary>
    public class ExchangeConfigReq
    {
        public string? lang { get; set; }
    }

    /// <summary>
    /// Response model for exchange configuration item
    /// </summary>
    public class ExchangeConfigItem
    {
        public decimal id { get; set; }
        public string productName { get; set; } = null!; // PRODUCT_NAME
        public decimal? coinCost { get; set; } // COIN_COST
        public decimal? moneyReceived { get; set; } // MONEY_RECEIVED
        public decimal? feeCoin { get; set; } // FEE_COIN
        public string description { get; set; } = null!; // DESCRIPTION
    }
}
