using Newtonsoft.Json.Linq;
using System.Collections.Generic;

namespace SicboSub.Web.Models
{
    public class RegisterReq
    {
        public string msisdn { get; set; }
        public string packageCode { get; set; }
        public string lang { get; set; }
    }

    public class RegisterData
    {
        public string msisdn { get; set; }
        public decimal? winCoin { get; set; }
        public decimal? betCoin { get; set; }
        public decimal? coin { get; set; }
        public string packageCode { get; set; }
        public string regKey { get; set; }
    }

    public class RegisterRes : CommonResponse
    {
        public RegisterData? data { get; set; }

        public RegisterRes(string dataGet)
        {
            JObject jObject = JObject.Parse(dataGet);
            BuildCommonResponse(dataGet);

            if (jObject != null && jObject["data"] != null)
            {
                data = jObject["data"]!.ToObject<RegisterData>();
            }
        }
    }

    public class BuyMoreReq
    {
        public string msisdn { get; set; }
        public string packageCode { get; set; }
        public string lang { get; set; }
    }

    public class BuyMoreData
    {
        public string msisdn { get; set; }
        public decimal? winCoin { get; set; }
        public decimal? betCoin { get; set; }
        public decimal? coin { get; set; }
        public string packageCode { get; set; }
    }

    public class BuyMoreRes : CommonResponse
    {
        public BuyMoreData? data { get; set; }

        public BuyMoreRes(string dataGet)
        {
            JObject jObject = JObject.Parse(dataGet);
            BuildCommonResponse(dataGet);

            if (jObject != null && jObject["data"] != null)
            {
                data = jObject["data"]!.ToObject<BuyMoreData>();
            }
        }
    }

    public class PackageLoadReq
    {
        public string lang { get; set; }
        public int pageNumber { get; set; } = 0;
        public int pageSize { get; set; } = 20;
    }

    public class PackageInfo
    {
        public int productId { get; set; }
        public string productName { get; set; }
        public decimal fee { get; set; }
        public decimal numberSpin { get; set; }
        public int expireDays { get; set; }
        public string smsSyntax { get; set; }
    }

    public class PackageLoadData
    {
        public List<PackageInfo> packages { get; set; }
        public object pagination { get; set; }
    }

    public class PackageLoadRes : CommonResponse
    {
        public List<PackageInfo>? data { get; set; }

        public PackageLoadRes(string dataGet)
        {
            JObject jObject = JObject.Parse(dataGet);
            BuildCommonResponse(dataGet);

            if (jObject != null && jObject["data"] != null)
            {
                var dataObj = jObject["data"];
                if (dataObj["packages"] != null)
                {
                    data = dataObj["packages"]!.ToObject<List<PackageInfo>>();
                }
            }
        }
    }
}
