using System.Text.Json.Serialization;

namespace HoneyBox.Model.Models.Equity;

/// <summary>
/// 权益中心响应
/// </summary>
public class QuanYiResponse
{
    /// <summary>
    /// 用户头像
    /// </summary>
    [JsonPropertyName("user_img")]
    public string UserImg { get; set; } = string.Empty;

    /// <summary>
    /// 用户权益等级信息
    /// </summary>
    [JsonPropertyName("quan_yi_level")]
    public QuanYiLevelInfo QuanYiLevel { get; set; } = new();

    /// <summary>
    /// 等级列表
    /// </summary>
    [JsonPropertyName("level_list")]
    public List<QuanYiLevelDto> LevelList { get; set; } = new();

    /// <summary>
    /// 单页内容列表
    /// </summary>
    [JsonPropertyName("danye_list")]
    public List<DanyeDto> DanyeList { get; set; } = new();
}

/// <summary>
/// 权益等级信息
/// </summary>
public class QuanYiLevelInfo
{
    /// <summary>
    /// 当前等级
    /// </summary>
    [JsonPropertyName("level")]
    public int Level { get; set; }

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

    /// <summary>
    /// 当前欧气值
    /// </summary>
    [JsonPropertyName("ou_qi")]
    public int OuQi { get; set; }

    /// <summary>
    /// 下一等级所需欧气值
    /// </summary>
    [JsonPropertyName("next_ou_qi")]
    public int NextOuQi { get; set; }

    /// <summary>
    /// 距离下一等级还差多少欧气值（-1表示已满级）
    /// </summary>
    [JsonPropertyName("cha")]
    public int Cha { get; set; }

    /// <summary>
    /// 当前等级进度百分比（0-100）
    /// </summary>
    [JsonPropertyName("jindu")]
    public int Jindu { get; set; }
}

/// <summary>
/// 权益等级DTO
/// </summary>
public class QuanYiLevelDto
{
    /// <summary>
    /// 等级ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

    /// <summary>
    /// 等级
    /// </summary>
    [JsonPropertyName("level")]
    public int Level { get; set; }

    /// <summary>
    /// 普通奖品列表（优惠券）
    /// </summary>
    [JsonPropertyName("pu_jiang")]
    public List<QuanYiRewardDto> PuJiang { get; set; } = new();

    /// <summary>
    /// 高级奖品列表（实物奖品）
    /// </summary>
    [JsonPropertyName("gao_jiang")]
    public List<QuanYiRewardDto> GaoJiang { get; set; } = new();

    /// <summary>
    /// 是否可领取：0-不可领取 1-可领取 2-已领取
    /// </summary>
    [JsonPropertyName("is_ling")]
    public int IsLing { get; set; }
}

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

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

    /// <summary>
    /// 数量
    /// </summary>
    [JsonPropertyName("z_num")]
    public int? ZNum { get; set; }

    /// <summary>
    /// 图片URL
    /// </summary>
    [JsonPropertyName("imgurl")]
    public string? ImgUrl { get; set; }
}

/// <summary>
/// 单页内容DTO
/// </summary>
public class DanyeDto
{
    /// <summary>
    /// ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

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

    /// <summary>
    /// 内容
    /// </summary>
    [JsonPropertyName("content")]
    public string Content { get; set; } = string.Empty;
}

/// <summary>
/// 权益领取请求
/// </summary>
public class QuanYiLingRequest
{
    /// <summary>
    /// 等级ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }
}

/// <summary>
/// 权益领取响应 - 直接返回奖品数组以兼容前端
/// </summary>
public class QuanYiLingResponse : List<QuanYiLingRewardDto>
{
    public QuanYiLingResponse() : base() { }
    public QuanYiLingResponse(IEnumerable<QuanYiLingRewardDto> collection) : base(collection) { }
}

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

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

    /// <summary>
    /// 奖品类型：1-优惠券 2-实物奖品
    /// </summary>
    [JsonPropertyName("type")]
    public int Type { get; set; }

    /// <summary>
    /// 减免金额（优惠券）
    /// </summary>
    [JsonPropertyName("jian_price")]
    public decimal? JianPrice { get; set; }

    /// <summary>
    /// 满减门槛（优惠券）
    /// </summary>
    [JsonPropertyName("man_price")]
    public decimal? ManPrice { get; set; }

    /// <summary>
    /// 有效天数（优惠券）
    /// </summary>
    [JsonPropertyName("effective_day")]
    public int? EffectiveDay { get; set; }

    /// <summary>
    /// 过期时间（优惠券）
    /// </summary>
    [JsonPropertyName("end_time")]
    public string? EndTime { get; set; }

    /// <summary>
    /// 数量
    /// </summary>
    [JsonPropertyName("z_num")]
    public int? ZNum { get; set; }

    /// <summary>
    /// 图片URL（实物奖品）
    /// </summary>
    [JsonPropertyName("imgurl")]
    public string? ImgUrl { get; set; }

    /// <summary>
    /// 奖品等级ID（实物奖品）
    /// </summary>
    [JsonPropertyName("shang_id")]
    public int? ShangId { get; set; }
}
