namespace HoneyBox.Admin.Business.Models.Order;

/// <summary>
/// 订单列表请求
/// </summary>
public class OrderListRequest : PagedRequest
{
    /// <summary>
    /// 用户ID
    /// </summary>
    public int? UserId { get; set; }

    /// <summary>
    /// 手机号
    /// </summary>
    public string? Mobile { get; set; }

    /// <summary>
    /// 订单编号
    /// </summary>
    public string? OrderNum { get; set; }

    /// <summary>
    /// 开始日期
    /// </summary>
    public DateTime? StartDate { get; set; }

    /// <summary>
    /// 结束日期
    /// </summary>
    public DateTime? EndDate { get; set; }

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

    /// <summary>
    /// 订单类型
    /// </summary>
    public int? OrderType { get; set; }
}

/// <summary>
/// 订单列表响应
/// </summary>
public class OrderListResponse
{
    /// <summary>
    /// 订单ID
    /// </summary>
    public int Id { get; set; }

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

    /// <summary>
    /// 用户ID
    /// </summary>
    public int UserId { get; set; }

    /// <summary>
    /// 用户昵称
    /// </summary>
    public string? UserNickname { get; set; }

    /// <summary>
    /// 用户手机号
    /// </summary>
    public string? UserMobile { get; set; }

    /// <summary>
    /// 用户UID
    /// </summary>
    public string? UserUid { get; set; }

    /// <summary>
    /// 商品ID
    /// </summary>
    public int GoodsId { get; set; }

    /// <summary>
    /// 商品标题
    /// </summary>
    public string? GoodsTitle { get; set; }

    /// <summary>
    /// 商品图片
    /// </summary>
    public string? GoodsImgUrl { get; set; }

    /// <summary>
    /// 订单类型
    /// </summary>
    public int OrderType { get; set; }

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

    /// <summary>
    /// 折扣
    /// </summary>
    public decimal Discount { get; set; }

    /// <summary>
    /// 折后金额
    /// </summary>
    public decimal DiscountTotal { get; set; }

    /// <summary>
    /// 微信支付金额
    /// </summary>
    public decimal WeChatPayment { get; set; }

    /// <summary>
    /// 余额支付金额
    /// </summary>
    public decimal BalancePayment { get; set; }

    /// <summary>
    /// 积分支付金额
    /// </summary>
    public decimal IntegralPayment { get; set; }

    /// <summary>
    /// 钻石支付金额
    /// </summary>
    public decimal ScorePayment { get; set; }

    /// <summary>
    /// 优惠券抵扣金额
    /// </summary>
    public decimal? CouponPayment { get; set; }

    /// <summary>
    /// 购买数量
    /// </summary>
    public int Num { get; set; }

    /// <summary>
    /// 中奖数量
    /// </summary>
    public int PrizeNum { get; set; }

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

    /// <summary>
    /// 状态名称
    /// </summary>
    public string StatusName { get; set; } = string.Empty;

    /// <summary>
    /// 支付方式
    /// </summary>
    public int PayType { get; set; }

    /// <summary>
    /// 支付方式名称
    /// </summary>
    public string PayTypeName { get; set; } = string.Empty;

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

    /// <summary>
    /// 支付时间
    /// </summary>
    public DateTime? PayTime { get; set; }
}

/// <summary>
/// 订单详情响应
/// </summary>
public class OrderDetailResponse : OrderListResponse
{
    /// <summary>
    /// 奖品列表（按prize_code分组）
    /// </summary>
    public List<OrderPrizeGroupDto> PrizeGroups { get; set; } = new();
}

/// <summary>
/// 订单奖品分组DTO
/// </summary>
public class OrderPrizeGroupDto
{
    /// <summary>
    /// 奖品编码
    /// </summary>
    public string? PrizeCode { get; set; }

    /// <summary>
    /// 奖品标题
    /// </summary>
    public string? Title { get; set; }

    /// <summary>
    /// 奖品图片
    /// </summary>
    public string? ImgUrl { get; set; }

    /// <summary>
    /// 奖品价格
    /// </summary>
    public decimal Price { get; set; }

    /// <summary>
    /// 回收金额
    /// </summary>
    public decimal RecoveryMoney { get; set; }

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

    /// <summary>
    /// 奖品类型
    /// </summary>
    public int GoodsType { get; set; }

    /// <summary>
    /// 奖品等级ID
    /// </summary>
    public int ShangId { get; set; }

    /// <summary>
    /// 奖品详情列表
    /// </summary>
    public List<OrderPrizeItemDto> Items { get; set; } = new();
}

/// <summary>
/// 订单奖品项DTO
/// </summary>
public class OrderPrizeItemDto
{
    /// <summary>
    /// 订单详情ID
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 状态
    /// </summary>
    public int Status { get; set; }

    /// <summary>
    /// 状态名称
    /// </summary>
    public string StatusName { get; set; } = string.Empty;

    /// <summary>
    /// 回收单号
    /// </summary>
    public string? RecoveryNum { get; set; }

    /// <summary>
    /// 发货单号
    /// </summary>
    public string? SendNum { get; set; }

    /// <summary>
    /// 幸运号码
    /// </summary>
    public int LuckNo { get; set; }

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


/// <summary>
/// 综合订单列表请求（支持按账号类型和状态过滤）
/// </summary>
public class ComprehensiveOrderListRequest : OrderListRequest
{
    /// <summary>
    /// 账号类型（0-正常 1-推广 2-测试）
    /// </summary>
    public int? AccountType { get; set; }

    /// <summary>
    /// 账号状态（0-正常 1-封号）
    /// </summary>
    public int? AccountStatus { get; set; }
}

/// <summary>
/// 综合订单导出请求
/// </summary>
public class ComprehensiveOrderExportRequest
{
    /// <summary>
    /// 用户ID
    /// </summary>
    public int? UserId { get; set; }

    /// <summary>
    /// 手机号
    /// </summary>
    public string? Mobile { get; set; }

    /// <summary>
    /// 订单编号
    /// </summary>
    public string? OrderNum { get; set; }

    /// <summary>
    /// 开始日期
    /// </summary>
    public DateTime? StartDate { get; set; }

    /// <summary>
    /// 结束日期
    /// </summary>
    public DateTime? EndDate { get; set; }

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

    /// <summary>
    /// 账号类型（0-正常 1-推广 2-测试）
    /// </summary>
    public int? AccountType { get; set; }

    /// <summary>
    /// 账号状态（0-正常 1-封号）
    /// </summary>
    public int? AccountStatus { get; set; }
}
