using System.Text.Json.Serialization;
using HoneyBox.Model.Models;
using Microsoft.AspNetCore.Mvc;

namespace HoneyBox.Model.Models.Goods;

#region Request Models

/// <summary>
/// 商品列表请求
/// </summary>
public class GoodsListRequest : PageRequest
{
    /// <summary>
    /// 分类ID
    /// </summary>
    public int? CategoryId { get; set; }

    /// <summary>
    /// 商品类型 (-1表示全部)
    /// </summary>
    [JsonPropertyName("type")]
    public int Type { get; set; } = -1;
}

/// <summary>
/// 商品详情请求
/// </summary>
public class GoodsDetailRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 箱号 (0表示自动选择)
    /// </summary>
    [JsonPropertyName("goods_num")]
    public int GoodsNum { get; set; } = 0;
}

/// <summary>
/// 商品子奖品请求
/// </summary>
public class GoodsChildrenRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 箱号
    /// </summary>
    [JsonPropertyName("goods_num")]
    public int GoodsNum { get; set; }

    /// <summary>
    /// 奖品列表ID
    /// </summary>
    [JsonPropertyName("goods_list_id")]
    public int GoodsListId { get; set; }
}

/// <summary>
/// 商品扩展配置请求
/// </summary>
public class GoodsExtendRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 商品类型
    /// </summary>
    [JsonPropertyName("goods_type")]
    public int GoodsType { get; set; }
}

/// <summary>
/// 箱号列表请求
/// </summary>
public class BoxListRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }
}

/// <summary>
/// 箱号详情请求
/// </summary>
public class BoxDetailRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 页码 (每页10个箱号)
    /// </summary>
    [JsonPropertyName("page_no")]
    public int PageNo { get; set; } = 0;

    /// <summary>
    /// 排序方式: 0=箱号升序, 1=箱号降序, 2=余量降序
    /// </summary>
    [JsonPropertyName("sort")]
    public int Sort { get; set; } = 0;
}

/// <summary>
/// 奖品数量统计请求
/// </summary>
public class PrizeCountRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }
}

/// <summary>
/// 奖品内容请求
/// </summary>
public class PrizeContentRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 箱号
    /// </summary>
    [JsonPropertyName("num")]
    public int Num { get; set; }
}

/// <summary>
/// 中奖记录请求
/// </summary>
public class PrizeLogsRequest : PageRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    [FromQuery(Name = "goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 箱号
    /// </summary>
    [JsonPropertyName("goods_num")]
    [FromQuery(Name = "goods_num")]
    public int GoodsNum { get; set; }

    /// <summary>
    /// 赏品分类ID (null或0表示全部)
    /// </summary>
    [JsonPropertyName("shang_id")]
    [FromQuery(Name = "shang_id")]
    public int? ShangId { get; set; }
}

#endregion

#region Response/DTO Models

/// <summary>
/// 商品列表项DTO (兼容PHP API snake_case格式)
/// </summary>
public class GoodsListDto
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

    /// <summary>
    /// 商品标题
    /// </summary>
    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    /// <summary>
    /// 商品图片URL
    /// </summary>
    [JsonPropertyName("imgurl")]
    public string ImgUrl { get; set; } = string.Empty;

    /// <summary>
    /// 商品价格
    /// </summary>
    [JsonPropertyName("price")]
    public string Price { get; set; } = "0";

    /// <summary>
    /// 商品类型
    /// </summary>
    [JsonPropertyName("type")]
    public int Type { get; set; }

    /// <summary>
    /// 类型文字
    /// </summary>
    [JsonPropertyName("type_text")]
    public string TypeText { get; set; } = string.Empty;

    /// <summary>
    /// 总库存
    /// </summary>
    [JsonPropertyName("stock")]
    public int Stock { get; set; }

    /// <summary>
    /// 已售库存
    /// </summary>
    [JsonPropertyName("sale_stock")]
    public int SaleStock { get; set; }

    /// <summary>
    /// 状态
    /// </summary>
    [JsonPropertyName("status")]
    public int Status { get; set; }

    /// <summary>
    /// 是否锁定
    /// </summary>
    [JsonPropertyName("lock_is")]
    public int LockIs { get; set; }

    /// <summary>
    /// 是否首折
    /// </summary>
    [JsonPropertyName("is_shou_zhe")]
    public int IsShouZhe { get; set; }

    /// <summary>
    /// 是否新品
    /// </summary>
    [JsonPropertyName("new_is")]
    public int NewIs { get; set; }

    /// <summary>
    /// 参与次数
    /// </summary>
    [JsonPropertyName("join_count")]
    public int JoinCount { get; set; }

    /// <summary>
    /// 需要抽奖次数
    /// </summary>
    [JsonPropertyName("need_draw_num")]
    public int NeedDrawNum { get; set; }

    /// <summary>
    /// 显示价格
    /// </summary>
    [JsonPropertyName("show_price")]
    public string? ShowPrice { get; set; }

    /// <summary>
    /// 角标文字
    /// </summary>
    [JsonPropertyName("corner_text")]
    public string? CornerText { get; set; }
}

/// <summary>
/// 商品信息DTO
/// </summary>
public class GoodsInfoDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    [JsonPropertyName("imgurl")]
    public string ImgUrl { get; set; } = string.Empty;

    [JsonPropertyName("imgurl_detail")]
    public string ImgUrlDetail { get; set; } = string.Empty;

    [JsonPropertyName("imgurl_banner")]
    public string? ImgUrlBanner { get; set; }

    [JsonPropertyName("price")]
    public string Price { get; set; } = "0";

    [JsonPropertyName("stock")]
    public int Stock { get; set; }

    [JsonPropertyName("sale_stock")]
    public int SaleStock { get; set; }

    [JsonPropertyName("surplus_stock")]
    public int SurplusStock { get; set; }

    [JsonPropertyName("goodslist_stock")]
    public int GoodslistStock { get; set; }

    [JsonPropertyName("goodslist_surplus_stock")]
    public int GoodslistSurplusStock { get; set; }

    [JsonPropertyName("type")]
    public int Type { get; set; }

    [JsonPropertyName("type_text")]
    public string? TypeText { get; set; }

    [JsonPropertyName("status")]
    public int Status { get; set; }

    [JsonPropertyName("lock_is")]
    public int LockIs { get; set; }

    [JsonPropertyName("num")]
    public int Num { get; set; }

    [JsonPropertyName("addtime")]
    public string? Addtime { get; set; }

    [JsonPropertyName("goods_describe")]
    public string? GoodsDescribe { get; set; }

    [JsonPropertyName("coupon_is")]
    public int CouponIs { get; set; }

    [JsonPropertyName("coupon_pro")]
    public int CouponPro { get; set; }

    [JsonPropertyName("integral_is")]
    public int IntegralIs { get; set; }

    [JsonPropertyName("rage_is")]
    public int RageIs { get; set; }

    [JsonPropertyName("rage")]
    public int Rage { get; set; }

    [JsonPropertyName("lingzhu_is")]
    public int LingzhuIs { get; set; }

    [JsonPropertyName("lingzhu_fan")]
    public int LingzhuFan { get; set; }

    [JsonPropertyName("card_num")]
    public int CardNum { get; set; }

    [JsonPropertyName("is_shou_zhe")]
    public int IsShouZhe { get; set; }

    [JsonPropertyName("new_is")]
    public int NewIs { get; set; }

    [JsonPropertyName("collection_is")]
    public int CollectionIs { get; set; }

    [JsonPropertyName("three_time")]
    public int ThreeTime { get; set; }

    [JsonPropertyName("five_time")]
    public int FiveTime { get; set; }

    [JsonPropertyName("quanju_xiangou")]
    public int QuanjuXiangou { get; set; }

    [JsonPropertyName("daily_xiangou")]
    public int DailyXiangou { get; set; }

    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    [JsonPropertyName("shou_zhe_price")]
    public string ShouZhePrice { get; set; } = "0";
}


/// <summary>
/// 商品详情响应
/// </summary>
public class GoodsDetailResponseDto
{
    /// <summary>
    /// 商品信息
    /// </summary>
    [JsonPropertyName("goods")]
    public GoodsInfoDto Goods { get; set; } = new();

    /// <summary>
    /// 锁箱信息
    /// </summary>
    [JsonPropertyName("lock_info")]
    public LockInfoDto LockInfo { get; set; } = new();

    /// <summary>
    /// 参与用户头像列表
    /// </summary>
    [JsonPropertyName("join_user")]
    public List<string> JoinUser { get; set; } = new();

    /// <summary>
    /// 参与次数
    /// </summary>
    [JsonPropertyName("join_count")]
    public int JoinCount { get; set; }

    /// <summary>
    /// 奖品列表
    /// </summary>
    [JsonPropertyName("goodslist")]
    public List<GoodsListItemDto> GoodsList { get; set; } = new();

    /// <summary>
    /// 限购信息
    /// </summary>
    [JsonPropertyName("limit_info")]
    public LimitInfoDto LimitInfo { get; set; } = new();
}

/// <summary>
/// 锁箱信息DTO
/// </summary>
public class LockInfoDto
{
    /// <summary>
    /// 是否锁定
    /// </summary>
    [JsonPropertyName("lock_is")]
    public int LockIs { get; set; }

    /// <summary>
    /// 锁定用户昵称
    /// </summary>
    [JsonPropertyName("goods_lock_user_nickname")]
    public string? GoodsLockUserNickname { get; set; }

    /// <summary>
    /// 锁定用户头像
    /// </summary>
    [JsonPropertyName("goods_lock_user_headimg")]
    public string? GoodsLockUserHeadimg { get; set; }

    /// <summary>
    /// 锁箱剩余时间 (Unix时间戳)
    /// </summary>
    [JsonPropertyName("goods_lock_surplus_time")]
    public long GoodsLockSurplusTime { get; set; }
}

/// <summary>
/// 限购信息DTO
/// </summary>
public class LimitInfoDto
{
    /// <summary>
    /// 每日限购数量
    /// </summary>
    [JsonPropertyName("daily_xiangou")]
    public int DailyXiangou { get; set; }

    /// <summary>
    /// 今日已购数量
    /// </summary>
    [JsonPropertyName("daily_bought")]
    public int DailyBought { get; set; }

    /// <summary>
    /// 今日剩余可购数量
    /// </summary>
    [JsonPropertyName("daily_remaining")]
    public int DailyRemaining { get; set; }

    /// <summary>
    /// 全局限购数量
    /// </summary>
    [JsonPropertyName("quanju_xiangou")]
    public int QuanjuXiangou { get; set; }

    /// <summary>
    /// 全局已购数量
    /// </summary>
    [JsonPropertyName("global_bought")]
    public int GlobalBought { get; set; }

    /// <summary>
    /// 全局剩余可购数量
    /// </summary>
    [JsonPropertyName("global_remaining")]
    public int GlobalRemaining { get; set; }

    /// <summary>
    /// 是否测试用户
    /// </summary>
    [JsonPropertyName("user_test")]
    public int UserTest { get; set; }
}

/// <summary>
/// 奖品列表项DTO
/// </summary>
public class GoodsListItemDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("shang_info")]
    public ShangInfoDto? ShangInfo { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    [JsonPropertyName("stock")]
    public int Stock { get; set; }

    [JsonPropertyName("surplus_stock")]
    public int SurplusStock { get; set; }

    [JsonPropertyName("imgurl")]
    public string ImgUrl { get; set; } = string.Empty;

    [JsonPropertyName("goods_type")]
    public int GoodsType { get; set; }

    [JsonPropertyName("price")]
    public string Price { get; set; } = "0";

    [JsonPropertyName("sc_money")]
    public string ScMoney { get; set; } = "0";

    [JsonPropertyName("sale_time")]
    public string? SaleTime { get; set; }

    [JsonPropertyName("pro")]
    public string Pro { get; set; } = "0";

    [JsonPropertyName("children")]
    public bool Children { get; set; }

    [JsonPropertyName("real_pro")]
    public string RealPro { get; set; } = "0";
}

/// <summary>
/// 赏品等级信息DTO
/// </summary>
public class ShangInfoDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    [JsonPropertyName("img_url")]
    public string? ImgUrl { get; set; }

    [JsonPropertyName("color")]
    public string? Color { get; set; }

    [JsonPropertyName("special_img_url")]
    public string? SpecialImgUrl { get; set; }
}

/// <summary>
/// 子奖品DTO
/// </summary>
public class GoodsChildrenDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    [JsonPropertyName("imgurl")]
    public string ImgUrl { get; set; } = string.Empty;

    [JsonPropertyName("stock")]
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
    public int Stock { get; set; }

    [JsonPropertyName("surplus_stock")]
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
    public int SurplusStock { get; set; }

    [JsonPropertyName("goods_type")]
    public int GoodsType { get; set; }

    [JsonPropertyName("sale_time")]
    public string? SaleTime { get; set; }

    [JsonPropertyName("price")]
    public string Price { get; set; } = "0";

    [JsonPropertyName("sc_money")]
    public string ScMoney { get; set; } = "0";

    [JsonPropertyName("real_pro")]
    public string RealPro { get; set; } = "0";

    [JsonPropertyName("pro")]
    public string Pro { get; set; } = "0";

    [JsonPropertyName("pro_num")]
    public string ProNum { get; set; } = "0";

    [JsonPropertyName("shang_info")]
    public ShangInfoDto? ShangInfo { get; set; }
}

/// <summary>
/// 商品扩展配置DTO
/// </summary>
public class GoodsExtendDto
{
    [JsonPropertyName("pay_wechat")]
    public int PayWechat { get; set; }

    [JsonPropertyName("pay_balance")]
    public int PayBalance { get; set; }

    [JsonPropertyName("pay_currency")]
    public int PayCurrency { get; set; }

    [JsonPropertyName("pay_currency2")]
    public int PayCurrency2 { get; set; }

    [JsonPropertyName("pay_coupon")]
    public int PayCoupon { get; set; }

    [JsonPropertyName("is_deduction")]
    public int IsDeduction { get; set; }
}

/// <summary>
/// 箱号分组DTO
/// </summary>
public class BoxGroupDto
{
    /// <summary>
    /// 显示标题，如 "1-10"
    /// </summary>
    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    /// <summary>
    /// 页码（从0开始）
    /// </summary>
    [JsonPropertyName("page_no")]
    public int PageNo { get; set; }
}

/// <summary>
/// 箱号详情DTO
/// </summary>
public class BoxDetailDto
{
    [JsonPropertyName("num")]
    public int Num { get; set; }

    [JsonPropertyName("surplus_all_stock")]
    public int SurplusAllStock { get; set; }

    [JsonPropertyName("goodslist")]
    public List<BoxGoodsListDto> GoodsList { get; set; } = new();
}

/// <summary>
/// 箱号商品列表DTO
/// </summary>
public class BoxGoodsListDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("shang_info")]
    public ShangInfoDto? ShangInfo { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    [JsonPropertyName("surplus_stock")]
    public int SurplusStock { get; set; }

    [JsonPropertyName("stock")]
    public int Stock { get; set; }
}


#endregion

#region Collection Models

/// <summary>
/// 收藏请求
/// </summary>
public class CollectionRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 箱号
    /// </summary>
    [JsonPropertyName("goods_num")]
    public int GoodsNum { get; set; }

    /// <summary>
    /// 操作类型: add=收藏, remove=取消收藏
    /// </summary>
    [JsonPropertyName("action")]
    public string Action { get; set; } = "add";
}

/// <summary>
/// 收藏列表请求
/// </summary>
public class CollectionListRequest : PageRequest
{
    /// <summary>
    /// 商品类型 (0=全部)
    /// </summary>
    [JsonPropertyName("type")]
    public int Type { get; set; } = 0;
}

/// <summary>
/// 收藏列表响应 (兼容PHP API格式)
/// </summary>
public class CollectionListResponse
{
    [JsonPropertyName("data")]
    public List<CollectionDto> Data { get; set; } = new();

    [JsonPropertyName("last_page")]
    public int LastPage { get; set; }
}

/// <summary>
/// 收藏DTO (兼容PHP API格式)
/// </summary>
public class CollectionDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    [JsonPropertyName("type")]
    public int Type { get; set; }

    [JsonPropertyName("num")]
    public int Num { get; set; }

    [JsonPropertyName("goods_title")]
    public string GoodsTitle { get; set; } = string.Empty;

    [JsonPropertyName("goods_price")]
    public string GoodsPrice { get; set; } = "0";

    [JsonPropertyName("imgurl")]
    public string ImgUrl { get; set; } = string.Empty;

    [JsonPropertyName("stock")]
    public int Stock { get; set; }

    [JsonPropertyName("surplus_stock")]
    public int SurplusStock { get; set; }
}

/// <summary>
/// 删除收藏请求
/// </summary>
public class DeleteCollectionRequest
{
    /// <summary>
    /// 收藏记录ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }
}

/// <summary>
/// 取消收藏请求 (通过商品ID)
/// </summary>
public class CancelCollectionRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }
}

/// <summary>
/// 收藏状态查询请求
/// </summary>
/// <remarks>
/// 用于查询指定商品是否已被当前用户收藏
/// 此接口从商品详情接口(goods_detail)中拆分出来
/// </remarks>
public class CollectionStatusRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 箱号
    /// </summary>
    [JsonPropertyName("goods_num")]
    public int GoodsNum { get; set; }
}

/// <summary>
/// 收藏状态响应
/// </summary>
public class CollectionStatusResponse
{
    /// <summary>
    /// 是否已收藏: 0=未收藏, 1=已收藏
    /// </summary>
    [JsonPropertyName("collection_is")]
    public int CollectionIs { get; set; }
}

#endregion

#region Prize Statistics Models

/// <summary>
/// 奖品数量统计响应
/// </summary>
public class PrizeCountResponseDto
{
    [JsonPropertyName("list")]
    public List<PrizeCountItemDto> List { get; set; } = new();

    [JsonPropertyName("total")]
    public int Total { get; set; }

    [JsonPropertyName("surplus")]
    public int Surplus { get; set; }
}

/// <summary>
/// 奖品数量统计项DTO
/// </summary>
public class PrizeCountItemDto
{
    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("shang_info")]
    public ShangInfoDto? ShangInfo { get; set; }

    [JsonPropertyName("total")]
    public int Total { get; set; }

    [JsonPropertyName("surplus")]
    public int Surplus { get; set; }
}

/// <summary>
/// 奖品内容响应
/// </summary>
public class PrizeContentResponseDto
{
    [JsonPropertyName("list")]
    public List<GoodsListItemDto> List { get; set; } = new();
}

#endregion

#region Prize Logs Models

/// <summary>
/// 中奖记录响应
/// </summary>
public class PrizeLogsResponseDto
{
    [JsonPropertyName("category")]
    public List<CategoryDto> Category { get; set; } = new();

    [JsonPropertyName("data")]
    public List<PrizeLogDto> Data { get; set; } = new();

    [JsonPropertyName("last_page")]
    public int LastPage { get; set; }

    [JsonPropertyName("total")]
    public int Total { get; set; }
}

/// <summary>
/// 分类DTO - 用于中奖记录筛选
/// </summary>
public class CategoryDto
{
    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("shang_title")]
    public string ShangTitle { get; set; } = string.Empty;
}

/// <summary>
/// 中奖记录DTO - 匹配PHP API响应格式
/// </summary>
public class PrizeLogDto
{
    [JsonPropertyName("user_id")]
    public int UserId { get; set; }

    [JsonPropertyName("goodslist_title")]
    public string GoodslistTitle { get; set; } = string.Empty;

    [JsonPropertyName("goodslist_imgurl")]
    public string GoodslistImgurl { get; set; } = string.Empty;

    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("addtime")]
    public string Addtime { get; set; } = string.Empty;

    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    [JsonPropertyName("shang_title")]
    public string ShangTitle { get; set; } = string.Empty;

    [JsonPropertyName("user_info")]
    public PrizeLogUserDto? UserInfo { get; set; }

    [JsonPropertyName("shang_color")]
    public string ShangColor { get; set; } = string.Empty;
}

/// <summary>
/// 中奖记录用户信息DTO
/// </summary>
public class PrizeLogUserDto
{
    [JsonPropertyName("nickname")]
    public string Nickname { get; set; } = string.Empty;

    [JsonPropertyName("headimg")]
    public string HeadImg { get; set; } = string.Empty;
}

#endregion


#region Infinite Goods Detail Models

/// <summary>
/// 无限赏商品详情请求
/// </summary>
public class InfiniteGoodsDetailRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }
}

/// <summary>
/// 无限赏商品详情响应
/// </summary>
public class InfiniteGoodsDetailResponseDto
{
    /// <summary>
    /// 商品信息
    /// </summary>
    [JsonPropertyName("goods")]
    public InfiniteGoodsInfoDto Goods { get; set; } = new();

    /// <summary>
    /// 赏池分类列表
    /// </summary>
    [JsonPropertyName("goodslist")]
    public List<InfiniteGoodsPoolDto> GoodsList { get; set; } = new();

    /// <summary>
    /// 奖品列表
    /// </summary>
    [JsonPropertyName("goods_list")]
    public List<InfiniteGoodsItemDto> GoodsListItems { get; set; } = new();

    /// <summary>
    /// 优惠券数量
    /// </summary>
    [JsonPropertyName("draw_num")]
    public int DrawNum { get; set; }

    /// <summary>
    /// 单页ID
    /// </summary>
    [JsonPropertyName("danye_id")]
    public int DanyeId { get; set; }

    /// <summary>
    /// 限购信息
    /// </summary>
    [JsonPropertyName("limitInfo")]
    public LimitInfoDto LimitInfo { get; set; } = new();
}

/// <summary>
/// 无限赏商品信息DTO
/// </summary>
public class InfiniteGoodsInfoDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    [JsonPropertyName("imgurl_detail")]
    public string ImgUrlDetail { get; set; } = string.Empty;

    [JsonPropertyName("price")]
    public string Price { get; set; } = "0";

    [JsonPropertyName("stock")]
    public int Stock { get; set; }

    [JsonPropertyName("sale_stock")]
    public int SaleStock { get; set; }

    [JsonPropertyName("lock_is")]
    public int LockIs { get; set; }

    [JsonPropertyName("type")]
    public int Type { get; set; }

    [JsonPropertyName("type_text")]
    public string? TypeText { get; set; }

    [JsonPropertyName("status")]
    public int Status { get; set; }

    [JsonPropertyName("addtime")]
    public string? Addtime { get; set; }

    [JsonPropertyName("rage_is")]
    public int RageIs { get; set; }

    [JsonPropertyName("rage")]
    public int Rage { get; set; }

    [JsonPropertyName("item_card_id")]
    public int ItemCardId { get; set; }

    [JsonPropertyName("lingzhu_is")]
    public int LingzhuIs { get; set; }

    [JsonPropertyName("lingzhu_shang_id")]
    public int LingzhuShangId { get; set; }

    [JsonPropertyName("is_shou_zhe")]
    public int IsShouZhe { get; set; }

    [JsonPropertyName("daily_xiangou")]
    public int DailyXiangou { get; set; }

    [JsonPropertyName("quanju_xiangou")]
    public int QuanjuXiangou { get; set; }

    [JsonPropertyName("item_card")]
    public ItemCardDto? ItemCard { get; set; }

    [JsonPropertyName("user_rage_schedule")]
    public int UserRageSchedule { get; set; }

    [JsonPropertyName("user_rage")]
    public int UserRage { get; set; }

    [JsonPropertyName("item_card_info")]
    public string? ItemCardInfo { get; set; }

    [JsonPropertyName("need_draw_num")]
    public int NeedDrawNum { get; set; }

    [JsonPropertyName("join_user")]
    public List<string> JoinUser { get; set; } = new();

    [JsonPropertyName("join_count")]
    public int JoinCount { get; set; }

    [JsonPropertyName("collection_is")]
    public int CollectionIs { get; set; }
}

/// <summary>
/// 道具卡DTO
/// </summary>
public class ItemCardDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("type")]
    public int Type { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;
}

/// <summary>
/// 无限赏赏池分类DTO
/// </summary>
public class InfiniteGoodsPoolDto
{
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("pro")]
    public string Pro { get; set; } = "0";

    [JsonPropertyName("shang_title")]
    public string ShangTitle { get; set; } = string.Empty;

    [JsonPropertyName("shang_imgurl")]
    public string? ShangImgUrl { get; set; }

    [JsonPropertyName("shang_color")]
    public string? ShangColor { get; set; }

    [JsonPropertyName("lingzhu_shang_id")]
    public int LingzhuShangId { get; set; }

    [JsonPropertyName("goods_list")]
    public List<InfiniteGoodsItemDto> GoodsList { get; set; } = new();
}

/// <summary>
/// 无限赏奖品项DTO
/// </summary>
public class InfiniteGoodsItemDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    [JsonPropertyName("imgurl")]
    public string ImgUrl { get; set; } = string.Empty;

    [JsonPropertyName("price")]
    public string Price { get; set; } = "0";

    [JsonPropertyName("real_pro")]
    public string RealPro { get; set; } = "0";

    [JsonPropertyName("sc_money")]
    public string ScMoney { get; set; } = "0";

    [JsonPropertyName("goods_type")]
    public int GoodsType { get; set; }

    [JsonPropertyName("sale_time")]
    public string? SaleTime { get; set; }

    [JsonPropertyName("doubling")]
    public int Doubling { get; set; }

    [JsonPropertyName("shang_title")]
    public string ShangTitle { get; set; } = string.Empty;

    [JsonPropertyName("shang_imgurl")]
    public string? ShangImgUrl { get; set; }

    [JsonPropertyName("shang_color")]
    public string? ShangColor { get; set; }

    [JsonPropertyName("is_lingzhu")]
    public int IsLingzhu { get; set; }
}

#endregion

#region Combo Goods Detail Models (连击赏)

/// <summary>
/// 连击赏商品详情请求
/// </summary>
public class ComboGoodsDetailRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 类型: 0=普通池, 1=秘宝池
    /// </summary>
    [JsonPropertyName("type")]
    public int Type { get; set; } = 1;
}

/// <summary>
/// 连击赏商品详情响应
/// </summary>
public class ComboGoodsDetailResponseDto
{
    /// <summary>
    /// 商品信息
    /// </summary>
    [JsonPropertyName("goods")]
    public ComboGoodsInfoDto Goods { get; set; } = new();

    /// <summary>
    /// 赏池分类列表
    /// </summary>
    [JsonPropertyName("goodslist")]
    public List<InfiniteGoodsPoolDto> GoodsList { get; set; } = new();

    /// <summary>
    /// 奖品列表
    /// </summary>
    [JsonPropertyName("goods_list")]
    public List<InfiniteGoodsItemDto> GoodsListItems { get; set; } = new();

    /// <summary>
    /// 优惠券数量
    /// </summary>
    [JsonPropertyName("draw_num")]
    public int DrawNum { get; set; }
}

/// <summary>
/// 连击赏商品信息DTO
/// </summary>
public class ComboGoodsInfoDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    [JsonPropertyName("imgurl_detail")]
    public string ImgUrlDetail { get; set; } = string.Empty;

    [JsonPropertyName("price")]
    public string Price { get; set; } = "0";

    [JsonPropertyName("stock")]
    public int Stock { get; set; }

    [JsonPropertyName("sale_stock")]
    public int SaleStock { get; set; }

    [JsonPropertyName("lock_is")]
    public int LockIs { get; set; }

    [JsonPropertyName("type")]
    public int Type { get; set; }

    [JsonPropertyName("status")]
    public int Status { get; set; }

    [JsonPropertyName("addtime")]
    public string? Addtime { get; set; }

    [JsonPropertyName("lian_ji_num")]
    public int LianJiNum { get; set; }

    [JsonPropertyName("lian_ji_shang_id")]
    public int LianJiShangId { get; set; }

    [JsonPropertyName("is_shou_zhe")]
    public int IsShouZhe { get; set; }

    [JsonPropertyName("max_fa")]
    public int MaxFa { get; set; }

    [JsonPropertyName("user_mb_number")]
    public int UserMbNumber { get; set; }

    [JsonPropertyName("user_lian_ji_number")]
    public int UserLianJiNumber { get; set; }

    [JsonPropertyName("collection_is")]
    public int CollectionIs { get; set; }

    [JsonPropertyName("join_user")]
    public List<string> JoinUser { get; set; } = new();

    [JsonPropertyName("join_count")]
    public int JoinCount { get; set; }
}

#endregion

#region Shang Log Models (中奖记录)

/// <summary>
/// 一番赏中奖记录请求
/// </summary>
public class ShangLogRequest : PageRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 箱号
    /// </summary>
    [JsonPropertyName("goods_num")]
    public int GoodsNum { get; set; }

    /// <summary>
    /// 赏品分类ID (0表示全部)
    /// </summary>
    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; } = 0;
}

/// <summary>
/// 一番赏中奖记录响应
/// </summary>
public class ShangLogResponseDto
{
    /// <summary>
    /// 分类列表
    /// </summary>
    [JsonPropertyName("category")]
    public List<CategoryDto> Category { get; set; } = new();

    /// <summary>
    /// 中奖记录列表
    /// </summary>
    [JsonPropertyName("data")]
    public List<ShangLogItemDto> Data { get; set; } = new();

    /// <summary>
    /// 最后一页
    /// </summary>
    [JsonPropertyName("last_page")]
    public int LastPage { get; set; }
}

/// <summary>
/// 中奖记录项DTO
/// </summary>
public class ShangLogItemDto
{
    [JsonPropertyName("user_id")]
    public int UserId { get; set; }

    [JsonPropertyName("goodslist_title")]
    public string GoodslistTitle { get; set; } = string.Empty;

    [JsonPropertyName("goodslist_imgurl")]
    public string GoodslistImgurl { get; set; } = string.Empty;

    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("addtime")]
    public string Addtime { get; set; } = string.Empty;

    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    [JsonPropertyName("shang_title")]
    public string ShangTitle { get; set; } = string.Empty;

    [JsonPropertyName("user_info")]
    public PrizeLogUserDto? UserInfo { get; set; }

    [JsonPropertyName("shang_color")]
    public string ShangColor { get; set; } = string.Empty;

    [JsonPropertyName("luck_no")]
    public int LuckNo { get; set; }

    [JsonPropertyName("doubling")]
    public int Doubling { get; set; }

    [JsonPropertyName("is_lingzhu")]
    public int IsLingzhu { get; set; }
}

#endregion

#region Ling Zhu King Models (领主王)

/// <summary>
/// 领主王数据请求
/// </summary>
public class LingZhuKingRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 类型: 1=挑战人数, 2=领主记录
    /// </summary>
    [JsonPropertyName("type")]
    public int Type { get; set; } = 1;
}

/// <summary>
/// 领主王数据响应
/// </summary>
public class LingZhuKingResponseDto
{
    /// <summary>
    /// 商品信息
    /// </summary>
    [JsonPropertyName("goods")]
    public LingZhuGoodsDto? Goods { get; set; }

    /// <summary>
    /// 当前领主用户信息
    /// </summary>
    [JsonPropertyName("king_user")]
    public LingZhuKingUserDto? KingUser { get; set; }

    /// <summary>
    /// 挑战者列表或领主记录
    /// </summary>
    [JsonPropertyName("list")]
    public PageResponse<LingZhuListItemDto> List { get; set; } = new();

    /// <summary>
    /// 领主奖品列表
    /// </summary>
    [JsonPropertyName("ling_goods_list")]
    public List<LingZhuGoodsItemDto> LingGoodsList { get; set; } = new();
}

/// <summary>
/// 领主商品信息DTO
/// </summary>
public class LingZhuGoodsDto
{
    [JsonPropertyName("king_user_id")]
    public int KingUserId { get; set; }

    [JsonPropertyName("lingzhu_fan")]
    public int LingzhuFan { get; set; }

    [JsonPropertyName("lingzhu_shang_id")]
    public int LingzhuShangId { get; set; }
}

/// <summary>
/// 领主用户信息DTO
/// </summary>
public class LingZhuKingUserDto
{
    [JsonPropertyName("id")]
    public int Id { get; set; }

    [JsonPropertyName("nickname")]
    public string Nickname { get; set; } = string.Empty;

    [JsonPropertyName("headimg")]
    public string HeadImg { get; set; } = string.Empty;

    [JsonPropertyName("jiang_title")]
    public string JiangTitle { get; set; } = string.Empty;

    [JsonPropertyName("jiang_img")]
    public string JiangImg { get; set; } = string.Empty;

    [JsonPropertyName("count")]
    public int Count { get; set; }

    [JsonPropertyName("z_nums")]
    public int ZNums { get; set; }
}

/// <summary>
/// 领主列表项DTO
/// </summary>
public class LingZhuListItemDto
{
    [JsonPropertyName("user_id")]
    public int UserId { get; set; }

    [JsonPropertyName("nickname")]
    public string Nickname { get; set; } = string.Empty;

    [JsonPropertyName("headimg")]
    public string HeadImg { get; set; } = string.Empty;

    [JsonPropertyName("addtime")]
    public long? Addtime { get; set; }

    [JsonPropertyName("end_time")]
    public long? EndTime { get; set; }

    [JsonPropertyName("time")]
    public string? Time { get; set; }
}

/// <summary>
/// 领主奖品项DTO
/// </summary>
public class LingZhuGoodsItemDto
{
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    [JsonPropertyName("imgurl")]
    public string ImgUrl { get; set; } = string.Empty;

    [JsonPropertyName("shang_info")]
    public ShangInfoDto? ShangInfo { get; set; }
}

#endregion
