namespace HoneyBox.Model.Models.Welfare;

/// <summary>
/// 福利屋列表请求
/// </summary>
public class WelfareListRequest
{
    /// <summary>
    /// 类型: 1=进行中, 3=已结束
    /// </summary>
    public int Type { get; set; } = 1;

    /// <summary>
    /// 页码
    /// </summary>
    public int Page { get; set; } = 1;

    /// <summary>
    /// 每页数量
    /// </summary>
    public int Limit { get; set; } = 15;
}

/// <summary>
/// 福利屋列表响应
/// </summary>
public class WelfareListResponse
{
    /// <summary>
    /// 福利屋列表
    /// </summary>
    public List<WelfareItemDto> List { get; set; } = new();

    /// <summary>
    /// 最后一页页码
    /// </summary>
    public int LastPage { get; set; }

    /// <summary>
    /// 总记录数
    /// </summary>
    public int Total { get; set; }
}

/// <summary>
/// 福利屋项DTO
/// </summary>
public class WelfareItemDto
{
    /// <summary>
    /// 商品ID
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 标题
    /// </summary>
    public string Title { get; set; } = string.Empty;

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

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

    /// <summary>
    /// 类型
    /// </summary>
    public int Type { get; set; }

    /// <summary>
    /// 是否新品
    /// </summary>
    public int NewIs { get; set; }

    /// <summary>
    /// 全局限购
    /// </summary>
    public int QuanjuXiangou { get; set; }

    /// <summary>
    /// 抽奖限制
    /// </summary>
    public int ChoujiangXianzhi { get; set; }

    /// <summary>
    /// 商品描述
    /// </summary>
    public string GoodsDescribe { get; set; } = string.Empty;

    /// <summary>
    /// 是否已开奖
    /// </summary>
    public int IsOpen { get; set; }

    /// <summary>
    /// 解锁金额
    /// </summary>
    public decimal UnlockAmount { get; set; }

    /// <summary>
    /// 参与人数
    /// </summary>
    public int JoinCount { get; set; }

    /// <summary>
    /// 开始时间
    /// </summary>
    public string FlwStartTime { get; set; } = string.Empty;

    /// <summary>
    /// 结束时间
    /// </summary>
    public string FlwEndTime { get; set; } = string.Empty;

    /// <summary>
    /// 开奖时间
    /// </summary>
    public string OpenTime { get; set; } = string.Empty;

    /// <summary>
    /// 奖品列表
    /// </summary>
    public List<WelfareGoodsListItemDto> Goodslist { get; set; } = new();
}

/// <summary>
/// 福利屋奖品列表项DTO
/// </summary>
public class WelfareGoodsListItemDto
{
    /// <summary>
    /// 奖品标题
    /// </summary>
    public string Title { get; set; } = string.Empty;

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

    /// <summary>
    /// 库存
    /// </summary>
    public int Stock { get; set; }

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

    /// <summary>
    /// 市场回收金额
    /// </summary>
    public decimal ScMoney { get; set; }
}

/// <summary>
/// 福利屋详情请求
/// </summary>
public class WelfareDetailRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    public int GoodsId { get; set; }
}

/// <summary>
/// 福利屋详情响应
/// </summary>
public class WelfareDetailResponse
{
    /// <summary>
    /// 商品信息
    /// </summary>
    public WelfareGoodsDto Goods { get; set; } = new();

    /// <summary>
    /// 奖品列表
    /// </summary>
    public List<WelfarePrizeDto> Goodslist { get; set; } = new();

    /// <summary>
    /// 参与人数
    /// </summary>
    public int JoinCount { get; set; }

    /// <summary>
    /// 当前时间
    /// </summary>
    public string CurrentTime { get; set; } = string.Empty;

    /// <summary>
    /// 用户参与次数
    /// </summary>
    public int UserCount { get; set; }

    /// <summary>
    /// 用户在活动期间的消费数据
    /// </summary>
    public UserConsumptionDto UserConsumption { get; set; } = new();

    /// <summary>
    /// 活动状态
    /// </summary>
    public string Status { get; set; } = string.Empty;

    /// <summary>
    /// 状态文本
    /// </summary>
    public string StatusText { get; set; } = string.Empty;
}

/// <summary>
/// 用户消费数据DTO
/// </summary>
public class UserConsumptionDto
{
    /// <summary>
    /// 消费总额
    /// </summary>
    public decimal TotalAmount { get; set; }

    /// <summary>
    /// 订单数量
    /// </summary>
    public int OrderCount { get; set; }
}

/// <summary>
/// 福利屋商品DTO
/// </summary>
public class WelfareGoodsDto
{
    /// <summary>
    /// 商品ID
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 标题
    /// </summary>
    public string Title { get; set; } = string.Empty;

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

    /// <summary>
    /// 详情图片
    /// </summary>
    public string ImgurlDetail { get; set; } = string.Empty;

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

    /// <summary>
    /// 类型
    /// </summary>
    public int Type { get; set; }

    /// <summary>
    /// 是否新品
    /// </summary>
    public int NewIs { get; set; }

    /// <summary>
    /// 全局限购
    /// </summary>
    public int QuanjuXiangou { get; set; }

    /// <summary>
    /// 抽奖限制
    /// </summary>
    public int ChoujiangXianzhi { get; set; }

    /// <summary>
    /// 商品描述
    /// </summary>
    public string GoodsDescribe { get; set; } = string.Empty;

    /// <summary>
    /// 是否已开奖
    /// </summary>
    public int IsOpen { get; set; }

    /// <summary>
    /// 解锁金额
    /// </summary>
    public decimal UnlockAmount { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    public int Sort { get; set; }

    /// <summary>
    /// 开始时间
    /// </summary>
    public string FlwStartTime { get; set; } = string.Empty;

    /// <summary>
    /// 结束时间
    /// </summary>
    public string FlwEndTime { get; set; } = string.Empty;

    /// <summary>
    /// 开奖时间
    /// </summary>
    public string OpenTime { get; set; } = string.Empty;
}

/// <summary>
/// 福利屋奖品DTO
/// </summary>
public class WelfarePrizeDto
{
    /// <summary>
    /// 奖品ID
    /// </summary>
    public int Id { get; set; }

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

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

    /// <summary>
    /// 奖品详情图片
    /// </summary>
    public string ImgurlDetail { get; set; } = string.Empty;

    /// <summary>
    /// 库存
    /// </summary>
    public int Stock { get; set; }

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

    /// <summary>
    /// 市场回收金额
    /// </summary>
    public decimal ScMoney { get; set; }

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

    /// <summary>
    /// 剩余库存
    /// </summary>
    public int SurplusStock { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    public int Sort { get; set; }

    /// <summary>
    /// 奖品等级标题
    /// </summary>
    public string ShangTitle { get; set; } = string.Empty;

    /// <summary>
    /// 奖品等级颜色
    /// </summary>
    public string ShangColor { get; set; } = string.Empty;
}

/// <summary>
/// 参与者列表请求
/// </summary>
public class ParticipantsRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    public int GoodsId { get; set; }

    /// <summary>
    /// 页码
    /// </summary>
    public int Page { get; set; } = 1;

    /// <summary>
    /// 每页数量
    /// </summary>
    public int Limit { get; set; } = 15;
}

/// <summary>
/// 参与者DTO
/// </summary>
public class ParticipantDto
{
    /// <summary>
    /// 昵称
    /// </summary>
    public string Nickname { get; set; } = string.Empty;

    /// <summary>
    /// 头像
    /// </summary>
    public string Avatar { get; set; } = string.Empty;

    /// <summary>
    /// 参与时间
    /// </summary>
    public string CreateTime { get; set; } = string.Empty;
}

/// <summary>
/// 开奖记录请求
/// </summary>
public class WinningRecordsRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    public int GoodsId { get; set; }

    /// <summary>
    /// 页码
    /// </summary>
    public int Page { get; set; } = 1;

    /// <summary>
    /// 每页数量
    /// </summary>
    public int Limit { get; set; } = 15;
}

/// <summary>
/// 开奖记录DTO
/// </summary>
public class WinningRecordDto
{
    /// <summary>
    /// 昵称
    /// </summary>
    public string Nickname { get; set; } = string.Empty;

    /// <summary>
    /// 头像
    /// </summary>
    public string Avatar { get; set; } = string.Empty;

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

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

    /// <summary>
    /// 中奖时间
    /// </summary>
    public string CreateTime { get; set; } = string.Empty;
}

/// <summary>
/// 用户参与记录DTO
/// </summary>
public class UserParticipationDto
{
    /// <summary>
    /// 商品ID
    /// </summary>
    public int GoodsId { get; set; }

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

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

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

    /// <summary>
    /// 参与时间
    /// </summary>
    public string CreateTime { get; set; } = string.Empty;
}

/// <summary>
/// 用户中奖记录DTO
/// </summary>
public class UserWinningDto
{
    /// <summary>
    /// 商品ID
    /// </summary>
    public int GoodsId { get; set; }

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

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

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

    /// <summary>
    /// 中奖时间
    /// </summary>
    public string CreateTime { get; set; } = string.Empty;
}


/// <summary>
/// 福利屋购买请求
/// </summary>
public class WelfareBuyRequest
{
    /// <summary>
    /// 商品ID
    /// </summary>
    [System.Text.Json.Serialization.JsonPropertyName("goods_id")]
    [System.Text.Json.Serialization.JsonConverter(typeof(HoneyBox.Model.Converters.StringToIntConverter))]
    public int GoodsId { get; set; }

    /// <summary>
    /// 购买数量/抽奖次数
    /// </summary>
    [System.Text.Json.Serialization.JsonPropertyName("prize_num")]
    public int PrizeNum { get; set; } = 1;

    /// <summary>
    /// 是否使用余额抵扣 0=不抵扣 1=抵扣
    /// </summary>
    [System.Text.Json.Serialization.JsonPropertyName("use_money_is")]
    public int UseMoneyIs { get; set; }

    /// <summary>
    /// 是否使用积分抵扣 0=不抵扣 1=抵扣
    /// </summary>
    [System.Text.Json.Serialization.JsonPropertyName("use_integral_is")]
    public int UseIntegralIs { get; set; }

    /// <summary>
    /// 是否使用货币2抵扣 0=不抵扣 1=抵扣
    /// </summary>
    [System.Text.Json.Serialization.JsonPropertyName("use_money2_is")]
    public int UseMoney2Is { get; set; }

    /// <summary>
    /// 优惠券ID
    /// </summary>
    [System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
    [System.Text.Json.Serialization.JsonConverter(typeof(HoneyBox.Model.Converters.StringToIntConverter))]
    public int CouponId { get; set; }
}

/// <summary>
/// 福利屋购买响应
/// </summary>
public class WelfareBuyResponse
{
    /// <summary>
    /// 状态: 0=余额支付成功 1=需要微信支付
    /// </summary>
    public int Status { get; set; }

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

    /// <summary>
    /// 微信支付参数 (当Status=1时返回)
    /// </summary>
    public object? PayParams { get; set; }
}

/// <summary>
/// 福利屋列表请求 (兼容GET/POST)
/// </summary>
public class FuliwuListRequest
{
    /// <summary>
    /// 类型: 1=进行中, 3=已结束
    /// </summary>
    public int Type { get; set; } = 1;

    /// <summary>
    /// 页码
    /// </summary>
    public int Page { get; set; } = 1;
}

/// <summary>
/// 福利屋列表响应 (兼容PHP格式)
/// </summary>
public class FuliwuListResponse
{
    /// <summary>
    /// 福利屋列表数据
    /// </summary>
    public List<WelfareItemDto> Data { get; set; } = new();

    /// <summary>
    /// 最后一页页码
    /// </summary>
    public int LastPage { get; set; }
}


/// <summary>
/// 福利屋参与者列表响应
/// </summary>
public class WelfareParticipantsResponse
{
    /// <summary>
    /// 参与者列表
    /// </summary>
    public List<ParticipantDto> List { get; set; } = new();
}

/// <summary>
/// 福利屋开奖记录响应
/// </summary>
public class WelfareRecordsResponse
{
    /// <summary>
    /// 开奖记录列表
    /// </summary>
    public List<WinningRecordDto> List { get; set; } = new();
}
