using System.Text.Json.Serialization;

namespace HoneyBox.Model.Models.Coupon;

/// <summary>
/// 优惠券列表响应
/// </summary>
public class CouponListItemResponse
{
    /// <summary>
    /// 优惠券ID
    /// </summary>
    public int Id { get; set; }

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

    /// <summary>
    /// 优惠金额
    /// </summary>
    public decimal Price { get; set; }

    /// <summary>
    /// 满减门槛金额
    /// </summary>
    public decimal ManPrice { get; set; }

    /// <summary>
    /// 过期时间
    /// </summary>
    public DateTime? EndTime { get; set; }

    /// <summary>
    /// 使用状态: 0未使用 1已使用
    /// </summary>
    public byte State { get; set; }
}

/// <summary>
/// 领取优惠券请求
/// </summary>
public class ReceiveCouponRequest
{
    /// <summary>
    /// 优惠券模板ID
    /// </summary>
    public int CouponId { get; set; }
}

/// <summary>
/// 批量领取优惠券请求
/// </summary>
public class BatchReceiveCouponRequest
{
    /// <summary>
    /// 优惠券ID列表，逗号分隔
    /// </summary>
    public string CouponId { get; set; } = string.Empty;
}

/// <summary>
/// 待领取优惠券数量响应
/// </summary>
public class PendingCouponCountResponse
{
    /// <summary>
    /// 待领取优惠券数量
    /// </summary>
    [JsonPropertyName("count")]
    public int Count { get; set; }
}

/// <summary>
/// 可领取优惠券列表响应
/// </summary>
public class AvailableCouponListResponse
{
    /// <summary>
    /// 状态: 1-可领取 2-已领取过
    /// </summary>
    public int Status { get; set; }

    /// <summary>
    /// 优惠券列表
    /// </summary>
    public List<AvailableCouponDto> Goods { get; set; } = new();
}

/// <summary>
/// 可领取优惠券DTO
/// </summary>
public class AvailableCouponDto
{
    /// <summary>
    /// 优惠券ID
    /// </summary>
    public int Id { get; set; }

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

    /// <summary>
    /// 优惠金额
    /// </summary>
    public decimal Price { get; set; }

    /// <summary>
    /// 满减门槛金额
    /// </summary>
    public decimal ManPrice { get; set; }

    /// <summary>
    /// 有效天数
    /// </summary>
    public int EffectiveDay { get; set; }
}

/// <summary>
/// 可使用优惠券列表请求
/// </summary>
public class UsableCouponListRequest
{
    /// <summary>
    /// 订单总价（从计算金额进入时必填）
    /// </summary>
    public decimal? TotalPrice { get; set; }

    /// <summary>
    /// 类型: 1-从个人中心进 2-从计算金额进
    /// </summary>
    public int Type { get; set; } = 1;

    /// <summary>
    /// 子类型: 1-可用 2-不可用
    /// </summary>
    public int Type1 { get; set; } = 1;

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

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

    /// <summary>
    /// 优惠券子类型
    /// </summary>
    public int? State { get; set; }
}

/// <summary>
/// 可使用优惠券列表响应
/// </summary>
public class UsableCouponListResponse
{
    /// <summary>
    /// 优惠券列表
    /// </summary>
    public List<UsableCouponDto> Data { get; set; } = new();

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

/// <summary>
/// 可使用优惠券DTO
/// </summary>
public class UsableCouponDto
{
    /// <summary>
    /// 优惠券ID
    /// </summary>
    public int Id { get; set; }

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

    /// <summary>
    /// 优惠金额
    /// </summary>
    public decimal Price { get; set; }

    /// <summary>
    /// 满减门槛金额
    /// </summary>
    public decimal ManPrice { get; set; }

    /// <summary>
    /// 过期时间
    /// </summary>
    public string EndTime { get; set; } = string.Empty;

    /// <summary>
    /// 状态: 0未使用 1已使用 2已过期
    /// </summary>
    public byte Status { get; set; }

    /// <summary>
    /// 状态标记
    /// </summary>
    public string Mark { get; set; } = string.Empty;

    /// <summary>
    /// 优惠券模板ID
    /// </summary>
    public int CouponId { get; set; }
}

/// <summary>
/// 领券中心优惠券列表请求
/// </summary>
public class CouponCenterListRequest
{
    /// <summary>
    /// 页码
    /// </summary>
    public int Page { get; set; } = 1;

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

    /// <summary>
    /// 类型: 1-可用 2-已分享
    /// </summary>
    public int Type { get; set; } = 1;

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

/// <summary>
/// 领券中心领取请求
/// </summary>
public class CouponCenterReceiveRequest
{
    /// <summary>
    /// 优惠券ID
    /// </summary>
    public int CouponId { get; set; }
}
