using System.Text.Json.Serialization;
using HoneyBox.Model.Models;
using HoneyBox.Model.Models.Goods;

namespace HoneyBox.Model.Models.Order;

#region Request Models

/// <summary>
/// 一番赏订单金额计算请求
/// </summary>
public class OrderMoneyRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

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

    /// <summary>
    /// 抽奖次数
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    /// <summary>
    /// 优惠券ID
    /// </summary>
    [JsonPropertyName("coupon_id")]
    public string? CouponId { get; set; }

    /// <summary>
    /// 是否使用余额：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money_is")]
    public int UseMoneyIs { get; set; } = 2;

    /// <summary>
    /// 是否使用积分：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_integral_is")]
    public int UseIntegralIs { get; set; } = 2;

    /// <summary>
    /// 是否使用哈尼券：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money2_is")]
    public int UseMoney2Is { get; set; } = 2;
}

/// <summary>
/// 一番赏订单创建请求
/// </summary>
public class OrderBuyRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

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

    /// <summary>
    /// 抽奖次数
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    /// <summary>
    /// 优惠券ID
    /// </summary>
    [JsonPropertyName("coupon_id")]
    public string? CouponId { get; set; }

    /// <summary>
    /// 是否使用余额：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money_is")]
    public int UseMoneyIs { get; set; } = 2;

    /// <summary>
    /// 是否使用积分：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_integral_is")]
    public int UseIntegralIs { get; set; } = 2;

    /// <summary>
    /// 是否使用哈尼券：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money2_is")]
    public int UseMoney2Is { get; set; } = 2;
}

/// <summary>
/// 无限赏订单金额计算请求
/// </summary>
public class InfiniteOrderMoneyRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 抽奖次数
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    /// <summary>
    /// 是否使用余额：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money_is")]
    public int UseMoneyIs { get; set; } = 2;

    /// <summary>
    /// 是否使用积分：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_integral_is")]
    public int UseIntegralIs { get; set; } = 2;

    /// <summary>
    /// 是否使用哈尼券：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money2_is")]
    public int UseMoney2Is { get; set; } = 2;

    /// <summary>
    /// 优惠券ID
    /// </summary>
    [JsonPropertyName("coupon_id")]
    public string? CouponId { get; set; }
}

/// <summary>
/// 无限赏订单创建请求
/// </summary>
public class InfiniteOrderBuyRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 抽奖次数
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    /// <summary>
    /// 是否使用余额：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money_is")]
    public int UseMoneyIs { get; set; } = 2;

    /// <summary>
    /// 是否使用积分：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_integral_is")]
    public int UseIntegralIs { get; set; } = 2;

    /// <summary>
    /// 是否使用哈尼券：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money2_is")]
    public int UseMoney2Is { get; set; } = 2;

    /// <summary>
    /// 优惠券ID
    /// </summary>
    [JsonPropertyName("coupon_id")]
    public string? CouponId { get; set; }
}

/// <summary>
/// 商城订单金额计算请求
/// </summary>
public class MallOrderMoneyRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 奖品ID
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    /// <summary>
    /// 购买数量
    /// </summary>
    [JsonPropertyName("goods_num")]
    public int GoodsNum { get; set; }

    /// <summary>
    /// 是否使用余额：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money_is")]
    public int UseMoneyIs { get; set; } = 2;

    /// <summary>
    /// 是否使用积分：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_integral_is")]
    public int UseIntegralIs { get; set; } = 2;

    /// <summary>
    /// 是否使用哈尼券：1=使用，2=不使用
    /// </summary>
    [JsonPropertyName("use_money2_is")]
    public int UseMoney2Is { get; set; } = 2;
}

/// <summary>
/// 订单列表请求
/// </summary>
public class OrderListRequest : PageRequest
{
    /// <summary>
    /// 订单状态
    /// </summary>
    [JsonPropertyName("status")]
    public int? Status { get; set; }
}

/// <summary>
/// 订单详情请求
/// </summary>
public class OrderDetailRequest
{
    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;
}

/// <summary>
/// 抽奖结果查询请求
/// </summary>
public class PrizeOrderLogRequest
{
    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;
}

#endregion

#region Response/DTO Models

/// <summary>
/// 订单金额计算响应
/// </summary>
public class OrderCalculationDto
{
    /// <summary>
    /// 订单总金额（实际支付）
    /// </summary>
    [JsonPropertyName("order_total")]
    public string OrderTotal { get; set; } = "0.00";

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

    /// <summary>
    /// 商品信息（兼容旧版字段名 goods）
    /// </summary>
    [JsonPropertyName("goods")]
    public GoodsInfoDto? Goods { get; set; }

    /// <summary>
    /// 商品扩展配置（兼容旧版字段名 goods_extend）
    /// </summary>
    [JsonPropertyName("goods_extend")]
    public GoodsExtendDto? GoodsExtend { get; set; }

    /// <summary>
    /// 用户余额（兼容旧版字段名 money）
    /// </summary>
    [JsonPropertyName("money")]
    public string Money { get; set; } = "0.00";

    /// <summary>
    /// 用户积分（兼容旧版字段名 integral）
    /// </summary>
    [JsonPropertyName("integral")]
    public string Integral { get; set; } = "0.00";

    /// <summary>
    /// 用户哈尼券（兼容旧版字段名 score）
    /// </summary>
    [JsonPropertyName("score")]
    public decimal Score { get; set; } = 0;

    /// <summary>
    /// 使用余额金额
    /// </summary>
    [JsonPropertyName("use_money")]
    public string UseMoney { get; set; } = "0.00";

    /// <summary>
    /// 使用积分（原始值，1:100比例）
    /// </summary>
    [JsonPropertyName("use_integral")]
    public string UseIntegral { get; set; } = "0.00";

    /// <summary>
    /// 使用积分换算成金额
    /// </summary>
    [JsonPropertyName("use_integral_money")]
    public string UseIntegralMoney { get; set; } = "0.00";

    /// <summary>
    /// 使用哈尼券（兼容旧版字段名 use_score）
    /// </summary>
    [JsonPropertyName("use_score")]
    public decimal UseScore { get; set; } = 0;

    /// <summary>
    /// 使用哈尼券（保留兼容）
    /// </summary>
    [JsonPropertyName("use_money2")]
    public decimal UseMoney2 { get; set; } = 0;

    /// <summary>
    /// 优惠券ID
    /// </summary>
    [JsonPropertyName("coupon_id")]
    public int CouponId { get; set; } = 0;

    /// <summary>
    /// 优惠券抵扣金额
    /// </summary>
    [JsonPropertyName("coupon_price")]
    public string CouponPrice { get; set; } = "0.00";

    /// <summary>
    /// 可用优惠券列表
    /// </summary>
    [JsonPropertyName("available_coupons")]
    public List<AvailableCouponDto>? AvailableCoupons { get; set; }

    /// <summary>
    /// 每日优惠券限制
    /// </summary>
    [JsonPropertyName("daily_coupon_limit")]
    public int DailyCouponLimit { get; set; } = 0;

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

    /// <summary>
    /// 折扣比例
    /// </summary>
    [JsonPropertyName("zhe")]
    public string Zhe { get; set; } = "1.00";

    /// <summary>
    /// 折后总金额
    /// </summary>
    [JsonPropertyName("order_zhe_total")]
    public string OrderZheTotal { get; set; } = "0.00";
}

/// <summary>
/// 可用优惠券DTO
/// </summary>
public class AvailableCouponDto
{
    /// <summary>
    /// 优惠券ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

    /// <summary>
    /// 优惠券名称
    /// </summary>
    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    /// <summary>
    /// 优惠金额
    /// </summary>
    [JsonPropertyName("money")]
    public string Money { get; set; } = "0.00";

    /// <summary>
    /// 满减条件
    /// </summary>
    [JsonPropertyName("min_money")]
    public string MinMoney { get; set; } = "0.00";

    /// <summary>
    /// 过期时间
    /// </summary>
    [JsonPropertyName("expire_time")]
    public long ExpireTime { get; set; }
}

/// <summary>
/// 订单创建响应
/// </summary>
public class OrderBuyResponseDto
{
    /// <summary>
    /// 支付状态：0=需要支付，1=已支付（余额支付完成）
    /// </summary>
    [JsonPropertyName("status")]
    public int Status { get; set; }

    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;

    /// <summary>
    /// 微信支付参数
    /// </summary>
    [JsonPropertyName("res")]
    public WechatPayParamsDto? Res { get; set; }
}

/// <summary>
/// 微信支付参数
/// </summary>
public class WechatPayParamsDto
{
    /// <summary>
    /// 应用ID
    /// </summary>
    [JsonPropertyName("appId")]
    public string AppId { get; set; } = string.Empty;

    /// <summary>
    /// 时间戳
    /// </summary>
    [JsonPropertyName("timeStamp")]
    public string TimeStamp { get; set; } = string.Empty;

    /// <summary>
    /// 随机字符串
    /// </summary>
    [JsonPropertyName("nonceStr")]
    public string NonceStr { get; set; } = string.Empty;

    /// <summary>
    /// 预支付交易会话标识
    /// </summary>
    [JsonPropertyName("package")]
    public string Package { get; set; } = string.Empty;

    /// <summary>
    /// 签名类型
    /// </summary>
    [JsonPropertyName("signType")]
    public string SignType { get; set; } = "RSA";

    /// <summary>
    /// 签名
    /// </summary>
    [JsonPropertyName("paySign")]
    public string PaySign { get; set; } = string.Empty;
}

/// <summary>
/// 订单列表项DTO
/// </summary>
public class OrderListDto
{
    /// <summary>
    /// 订单ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;

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

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

    /// <summary>
    /// 订单总金额
    /// </summary>
    [JsonPropertyName("order_total")]
    public string OrderTotal { get; set; } = "0.00";

    /// <summary>
    /// 折后订单金额
    /// </summary>
    [JsonPropertyName("order_zhe_total")]
    public string OrderZheTotal { get; set; } = "0.00";

    /// <summary>
    /// 实际支付金额
    /// </summary>
    [JsonPropertyName("price")]
    public string Price { get; set; } = "0.00";

    /// <summary>
    /// 抽奖次数
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    /// <summary>
    /// 订单状态：0=待支付，1=已支付，2=已取消
    /// </summary>
    [JsonPropertyName("status")]
    public int Status { get; set; }

    /// <summary>
    /// 创建时间戳
    /// </summary>
    [JsonPropertyName("addtime")]
    public long AddTime { get; set; }

    /// <summary>
    /// 支付时间戳
    /// </summary>
    [JsonPropertyName("pay_time")]
    public long? PayTime { get; set; }

    /// <summary>
    /// 订单类型
    /// </summary>
    [JsonPropertyName("order_type")]
    public int OrderType { get; set; }
}

/// <summary>
/// 订单详情响应
/// </summary>
public class OrderDetailDto
{
    /// <summary>
    /// 订单信息
    /// </summary>
    [JsonPropertyName("order_info")]
    public OrderInfoDto? OrderInfo { get; set; }

    /// <summary>
    /// 奖品列表
    /// </summary>
    [JsonPropertyName("prize_list")]
    public List<PrizeItemDto>? PrizeList { get; set; }

    /// <summary>
    /// 支付记录
    /// </summary>
    [JsonPropertyName("payment_records")]
    public List<PaymentRecordDto>? PaymentRecords { get; set; }
}

/// <summary>
/// 订单信息DTO
/// </summary>
public class OrderInfoDto
{
    /// <summary>
    /// 订单ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;

    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

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

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

    /// <summary>
    /// 商品单价
    /// </summary>
    [JsonPropertyName("goods_price")]
    public string GoodsPrice { get; set; } = "0.00";

    /// <summary>
    /// 订单总金额
    /// </summary>
    [JsonPropertyName("order_total")]
    public string OrderTotal { get; set; } = "0.00";

    /// <summary>
    /// 折后订单金额
    /// </summary>
    [JsonPropertyName("order_zhe_total")]
    public string OrderZheTotal { get; set; } = "0.00";

    /// <summary>
    /// 实际支付金额
    /// </summary>
    [JsonPropertyName("price")]
    public string Price { get; set; } = "0.00";

    /// <summary>
    /// 使用余额
    /// </summary>
    [JsonPropertyName("use_money")]
    public string UseMoney { get; set; } = "0.00";

    /// <summary>
    /// 使用积分
    /// </summary>
    [JsonPropertyName("use_integral")]
    public string UseIntegral { get; set; } = "0.00";

    /// <summary>
    /// 使用哈尼券
    /// </summary>
    [JsonPropertyName("use_money2")]
    public string UseMoney2 { get; set; } = "0.00";

    /// <summary>
    /// 使用优惠券金额
    /// </summary>
    [JsonPropertyName("use_coupon")]
    public string UseCoupon { get; set; } = "0.00";

    /// <summary>
    /// 抽奖次数
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

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

    /// <summary>
    /// 创建时间戳
    /// </summary>
    [JsonPropertyName("addtime")]
    public long AddTime { get; set; }

    /// <summary>
    /// 支付时间戳
    /// </summary>
    [JsonPropertyName("pay_time")]
    public string? PayTime { get; set; }

    /// <summary>
    /// 订单类型
    /// </summary>
    [JsonPropertyName("order_type")]
    public int OrderType { get; set; }

    /// <summary>
    /// 奖品列表
    /// </summary>
    [JsonPropertyName("goods_list")]
    public List<OrderGoodsItemDto>? GoodsList { get; set; }
}

/// <summary>
/// 订单商品项DTO（用于订单详情）
/// </summary>
public class OrderGoodsItemDto
{
    /// <summary>
    /// 奖品标题
    /// </summary>
    [JsonPropertyName("goodslist_title")]
    public string GoodsListTitle { get; set; } = string.Empty;

    /// <summary>
    /// 奖品图片
    /// </summary>
    [JsonPropertyName("goodslist_imgurl")]
    public string GoodsListImgUrl { get; set; } = string.Empty;

    /// <summary>
    /// 奖品价格
    /// </summary>
    [JsonPropertyName("goodslist_price")]
    public decimal GoodsListPrice { get; set; }

    /// <summary>
    /// 添加时间
    /// </summary>
    [JsonPropertyName("addtime")]
    public string AddTime { get; set; } = string.Empty;
}

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

    /// <summary>
    /// 奖品标题
    /// </summary>
    [JsonPropertyName("goodslist_title")]
    public string GoodsListTitle { get; set; } = string.Empty;

    /// <summary>
    /// 奖品图片
    /// </summary>
    [JsonPropertyName("goodslist_imgurl")]
    public string GoodsListImgUrl { get; set; } = string.Empty;

    /// <summary>
    /// 奖品价格
    /// </summary>
    [JsonPropertyName("goodslist_price")]
    public string GoodsListPrice { get; set; } = "0.00";

    /// <summary>
    /// 回收金额
    /// </summary>
    [JsonPropertyName("goodslist_money")]
    public string GoodsListMoney { get; set; } = "0.00";

    /// <summary>
    /// 状态：0=待选择，1=已回收，2=已发货
    /// </summary>
    [JsonPropertyName("status")]
    public int Status { get; set; }

    /// <summary>
    /// 幸运号码
    /// </summary>
    [JsonPropertyName("luck_no")]
    public int LuckNo { get; set; }

    /// <summary>
    /// 赏品等级ID
    /// </summary>
    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    /// <summary>
    /// 赏品等级信息
    /// </summary>
    [JsonPropertyName("shang_info")]
    public ShangInfoDto? ShangInfo { get; set; }
}

/// <summary>
/// 支付记录DTO
/// </summary>
public class PaymentRecordDto
{
    /// <summary>
    /// 支付类型
    /// </summary>
    [JsonPropertyName("pay_type")]
    public string PayType { get; set; } = string.Empty;

    /// <summary>
    /// 支付金额
    /// </summary>
    [JsonPropertyName("amount")]
    public string Amount { get; set; } = "0.00";

    /// <summary>
    /// 支付时间
    /// </summary>
    [JsonPropertyName("pay_time")]
    public long PayTime { get; set; }
}

/// <summary>
/// 抽奖结果DTO
/// </summary>
public class PrizeOrderLogDto
{
    /// <summary>
    /// 奖品ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

    /// <summary>
    /// 用户ID
    /// </summary>
    [JsonPropertyName("user_id")]
    public int UserId { get; set; }

    /// <summary>
    /// 奖品标题
    /// </summary>
    [JsonPropertyName("goodslist_title")]
    public string GoodsListTitle { get; set; } = string.Empty;

    /// <summary>
    /// 奖品图片
    /// </summary>
    [JsonPropertyName("goodslist_imgurl")]
    public string GoodsListImgUrl { get; set; } = string.Empty;

    /// <summary>
    /// 奖品价格
    /// </summary>
    [JsonPropertyName("goodslist_price")]
    public string GoodsListPrice { get; set; } = "0.00";

    /// <summary>
    /// 回收金额
    /// </summary>
    [JsonPropertyName("goodslist_money")]
    public string GoodsListMoney { get; set; } = "0.00";

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

    /// <summary>
    /// 幸运号码
    /// </summary>
    [JsonPropertyName("luck_no")]
    public int LuckNo { get; set; }

    /// <summary>
    /// 赏品等级ID
    /// </summary>
    [JsonPropertyName("shang_id")]
    public int ShangId { get; set; }

    /// <summary>
    /// 赏品等级标题
    /// </summary>
    [JsonPropertyName("shang_title")]
    public string? ShangTitle { get; set; }

    /// <summary>
    /// 赏品等级信息
    /// </summary>
    [JsonPropertyName("shang_info")]
    public ShangInfoDto? ShangInfo { get; set; }

    /// <summary>
    /// 翻倍倍数
    /// </summary>
    [JsonPropertyName("doubling")]
    public int Doubling { get; set; }

    /// <summary>
    /// 是否灵珠
    /// </summary>
    [JsonPropertyName("is_lingzhu")]
    public int IsLingzhu { get; set; }

    /// <summary>
    /// 奖品类型
    /// </summary>
    [JsonPropertyName("goodslist_type")]
    public int GoodsListType { get; set; }

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

    /// <summary>
    /// 父商品奖品ID
    /// </summary>
    [JsonPropertyName("parent_goods_list_id")]
    public int ParentGoodsListId { get; set; }

    /// <summary>
    /// 中奖数量（分组后的数量）
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; } = 1;

    /// <summary>
    /// 创建时间戳
    /// </summary>
    [JsonPropertyName("addtime")]
    public long AddTime { get; set; }
}

#endregion

#region Legacy Models (保留兼容)

/// <summary>
/// 订单列表项响应（旧版）
/// </summary>
public class OrderListItemResponse
{
    /// <summary>
    /// 订单ID
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 订单号
    /// </summary>
    public string OrderNo { get; set; } = string.Empty;

    /// <summary>
    /// 订单状态
    /// </summary>
    public byte Status { get; set; }

    /// <summary>
    /// 订单金额
    /// </summary>
    public decimal Amount { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; }
}

/// <summary>
/// 订单详情响应（旧版）
/// </summary>
public class OrderDetailResponse
{
    /// <summary>
    /// 订单ID
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 订单号
    /// </summary>
    public string OrderNo { get; set; } = string.Empty;

    /// <summary>
    /// 订单状态
    /// </summary>
    public byte Status { get; set; }

    /// <summary>
    /// 订单金额
    /// </summary>
    public decimal Amount { get; set; }

    /// <summary>
    /// 收货人姓名
    /// </summary>
    public string? ReceiverName { get; set; }

    /// <summary>
    /// 收货人电话
    /// </summary>
    public string? ReceiverPhone { get; set; }

    /// <summary>
    /// 收货地址
    /// </summary>
    public string? ReceiverAddress { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; }

    /// <summary>
    /// 订单项列表
    /// </summary>
    public List<OrderItemResponse> Items { get; set; } = new();
}

/// <summary>
/// 订单项响应（旧版）
/// </summary>
public class OrderItemResponse
{
    /// <summary>
    /// 订单项ID
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 商品名称
    /// </summary>
    public string GoodsName { get; set; } = string.Empty;

    /// <summary>
    /// 商品图片
    /// </summary>
    public string GoodsImg { get; set; } = string.Empty;

    /// <summary>
    /// 数量
    /// </summary>
    public int Quantity { get; set; }

    /// <summary>
    /// 单价
    /// </summary>
    public decimal Price { get; set; }
}

/// <summary>
/// 创建订单请求（旧版）
/// </summary>
public class CreateOrderRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    public int GoodsId { get; set; }

    /// <summary>
    /// 数量
    /// </summary>
    public int Quantity { get; set; } = 1;

    /// <summary>
    /// 收货地址ID
    /// </summary>
    public int? AddressId { get; set; }
}

#endregion

#region Prize Order Log Response Models

/// <summary>
/// 一番赏抽奖结果响应
/// </summary>
public class PrizeOrderLogResponseDto
{
    /// <summary>
    /// 奖品列表
    /// </summary>
    [JsonPropertyName("data")]
    public List<PrizeOrderLogDto> Data { get; set; } = new();

    /// <summary>
    /// 重抽卡数量
    /// </summary>
    [JsonPropertyName("item_card_count")]
    public int ItemCardCount { get; set; }

    /// <summary>
    /// 用户获得的欧气券
    /// </summary>
    [JsonPropertyName("user_coupon")]
    public UserCouponInfoDto? UserCoupon { get; set; }

    /// <summary>
    /// 中奖数量
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }
}

/// <summary>
/// 无限赏抽奖结果响应
/// </summary>
public class InfinitePrizeOrderLogResponseDto
{
    /// <summary>
    /// 用户信息
    /// </summary>
    [JsonPropertyName("user_info")]
    public UserBasicInfoDto? UserInfo { get; set; }

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

    /// <summary>
    /// 重抽卡数量
    /// </summary>
    [JsonPropertyName("item_card_count")]
    public int ItemCardCount { get; set; }

    /// <summary>
    /// 用户获得的欧气券
    /// </summary>
    [JsonPropertyName("user_coupon")]
    public UserCouponInfoDto? UserCoupon { get; set; }

    /// <summary>
    /// 中奖数量
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }
}

/// <summary>
/// 用户基本信息DTO
/// </summary>
public class UserBasicInfoDto
{
    /// <summary>
    /// 昵称
    /// </summary>
    [JsonPropertyName("nickname")]
    public string Nickname { get; set; } = string.Empty;

    /// <summary>
    /// 头像
    /// </summary>
    [JsonPropertyName("headimg")]
    public string HeadImg { get; set; } = string.Empty;
}

/// <summary>
/// 用户欧气券信息DTO
/// </summary>
public class UserCouponInfoDto
{
    /// <summary>
    /// 欧气券ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

    /// <summary>
    /// 等级：1特级赏券 2终极赏券 3高级赏券 4普通赏券
    /// </summary>
    [JsonPropertyName("level")]
    public int Level { get; set; }

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

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

    /// <summary>
    /// 等级文本
    /// </summary>
    [JsonPropertyName("level_text")]
    public string LevelText { get; set; } = string.Empty;

    /// <summary>
    /// 等级图片
    /// </summary>
    [JsonPropertyName("level_img")]
    public string LevelImg { get; set; } = string.Empty;
}

#endregion


#region New Order Module Extension Models

/// <summary>
/// 订单状态查询请求
/// </summary>
public class GetOrderStatusRequest
{
    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;
}

/// <summary>
/// 订单状态响应
/// </summary>
public class OrderStatusResponseDto
{
    /// <summary>
    /// 支付状态：0=未支付，1=已支付，2=已失效
    /// </summary>
    [JsonPropertyName("status")]
    public int Status { get; set; }

    /// <summary>
    /// 状态消息
    /// </summary>
    [JsonPropertyName("message")]
    public string Message { get; set; } = string.Empty;
}

/// <summary>
/// 获取订单列表请求（GET方式）
/// </summary>
public class GetOrderListRequest
{
    /// <summary>
    /// 页码
    /// </summary>
    [JsonPropertyName("page")]
    public int Page { get; set; } = 1;

    /// <summary>
    /// 每页数量
    /// </summary>
    [JsonPropertyName("page_size")]
    public int PageSize { get; set; } = 10;
}

/// <summary>
/// 获取订单列表响应
/// </summary>
public class GetOrderListResponseDto
{
    /// <summary>
    /// 订单列表
    /// </summary>
    [JsonPropertyName("list")]
    public List<OrderListItemDto> List { get; set; } = new();

    /// <summary>
    /// 总数
    /// </summary>
    [JsonPropertyName("total")]
    public int Total { get; set; }

    /// <summary>
    /// 当前页
    /// </summary>
    [JsonPropertyName("page")]
    public int Page { get; set; }

    /// <summary>
    /// 每页数量
    /// </summary>
    [JsonPropertyName("page_size")]
    public int PageSize { get; set; }

    /// <summary>
    /// 总页数
    /// </summary>
    [JsonPropertyName("total_pages")]
    public int TotalPages { get; set; }
}

/// <summary>
/// 订单列表项DTO（GET方式）
/// </summary>
public class OrderListItemDto
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

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

    /// <summary>
    /// 商品单价
    /// </summary>
    [JsonPropertyName("goods_price")]
    public decimal GoodsPrice { get; set; }

    /// <summary>
    /// 订单总金额
    /// </summary>
    [JsonPropertyName("order_total")]
    public decimal OrderTotal { get; set; }

    /// <summary>
    /// 折后金额
    /// </summary>
    [JsonPropertyName("order_zhe_total")]
    public decimal OrderZheTotal { get; set; }

    /// <summary>
    /// 实付金额
    /// </summary>
    [JsonPropertyName("price")]
    public decimal Price { get; set; }

    /// <summary>
    /// 使用余额
    /// </summary>
    [JsonPropertyName("use_money")]
    public decimal UseMoney { get; set; }

    /// <summary>
    /// 使用积分
    /// </summary>
    [JsonPropertyName("use_integral")]
    public decimal UseIntegral { get; set; }

    /// <summary>
    /// 使用哈尼券
    /// </summary>
    [JsonPropertyName("use_money2")]
    public decimal UseMoney2 { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [JsonPropertyName("addtime")]
    public string Addtime { get; set; } = string.Empty;

    /// <summary>
    /// 支付时间
    /// </summary>
    [JsonPropertyName("pay_time")]
    public string PayTime { get; set; } = string.Empty;

    /// <summary>
    /// 抽奖次数
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    /// <summary>
    /// 使用优惠券金额
    /// </summary>
    [JsonPropertyName("use_coupon")]
    public decimal UseCoupon { get; set; }

    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;
}

/// <summary>
/// 创建网页支付订单请求
/// </summary>
public class CreateWebPayOrderRequest
{
    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;
}

/// <summary>
/// 网页支付订单响应
/// </summary>
public class WebPayOrderResponseDto
{
    /// <summary>
    /// 支付链接
    /// </summary>
    [JsonPropertyName("pay_url")]
    public string PayUrl { get; set; } = string.Empty;

    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;
}

/// <summary>
/// 获取订单链接请求
/// </summary>
public class GetOrderUrlLinkRequest
{
    /// <summary>
    /// 订单号
    /// </summary>
    [JsonPropertyName("order_num")]
    public string OrderNum { get; set; } = string.Empty;
}

/// <summary>
/// 订单链接响应
/// </summary>
public class OrderUrlLinkResponseDto
{
    /// <summary>
    /// URL链接
    /// </summary>
    [JsonPropertyName("url_link")]
    public string UrlLink { get; set; } = string.Empty;
}

/// <summary>
/// 商城下单请求
/// </summary>
public class MallOrderBuyRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 抽奖次数
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }
}

/// <summary>
/// 道具卡列表请求
/// </summary>
public class ItemCardListRequest
{
    /// <summary>
    /// 页码
    /// </summary>
    [JsonPropertyName("page")]
    public int Page { get; set; } = 1;

    /// <summary>
    /// 每页数量
    /// </summary>
    [JsonPropertyName("page_size")]
    public int PageSize { get; set; } = 20;
}

/// <summary>
/// 道具卡列表响应
/// </summary>
public class ItemCardListResponseDto
{
    /// <summary>
    /// 道具卡列表
    /// </summary>
    [JsonPropertyName("list")]
    public List<OrderItemCardDto> List { get; set; } = new();

    /// <summary>
    /// 总数
    /// </summary>
    [JsonPropertyName("count")]
    public int Count { get; set; }

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

/// <summary>
/// 订单模块道具卡DTO（包含时间字段）
/// </summary>
public class OrderItemCardDto
{
    /// <summary>
    /// ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

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

    /// <summary>
    /// 名称
    /// </summary>
    [JsonPropertyName("title")]
    public string Title { get; set; } = string.Empty;

    /// <summary>
    /// 创建时间
    /// </summary>
    [JsonPropertyName("addtime")]
    public string Addtime { get; set; } = string.Empty;
}

/// <summary>
/// 连击赏秘宝下单请求
/// </summary>
public class InfiniteMibaoOrderBuyRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int GoodsId { get; set; }

    /// <summary>
    /// 抽奖次数
    /// </summary>
    [JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; }

    /// <summary>
    /// 是否秘宝池：1=是，0=否
    /// </summary>
    [JsonPropertyName("is_mibao")]
    public int IsMibao { get; set; }
}

/// <summary>
/// 获取测试用户请求
/// </summary>
public class GetUserTestRequest
{
    /// <summary>
    /// 用户ID
    /// </summary>
    [JsonPropertyName("user_id")]
    public int UserId { get; set; }
}

/// <summary>
/// 测试用户响应
/// </summary>
public class UserTestResponseDto
{
    /// <summary>
    /// 用户Token
    /// </summary>
    [JsonPropertyName("token")]
    public string Token { get; set; } = string.Empty;
}

#endregion
