namespace HoneyBox.Admin.Business.Models.Statistics;

/// <summary>
/// 盒子统计请求
/// </summary>
public class BoxStatisticsRequest
{
    /// <summary>
    /// 盒子ID
    /// </summary>
    public int GoodsId { get; set; }

    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }

    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime? EndTime { get; set; }
}

/// <summary>
/// 盒子统计响应
/// </summary>
public class BoxStatisticsResponse
{
    /// <summary>
    /// 盒子ID
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 消费金额（充值金额 + 余额消费）
    /// </summary>
    public decimal UseMoney { get; set; }

    /// <summary>
    /// 出货成本（奖品价值）
    /// </summary>
    public decimal ScMoney { get; set; }

    /// <summary>
    /// 兑换成本（已回收的奖品价值）
    /// </summary>
    public decimal ReMoney { get; set; }

    /// <summary>
    /// 发货成本（已发货的奖品价值）
    /// </summary>
    public decimal FhMoney { get; set; }

    /// <summary>
    /// 抽奖次数
    /// </summary>
    public int CjCount { get; set; }

    /// <summary>
    /// 利润 = UseMoney - (ScMoney - ReMoney)
    /// </summary>
    public decimal Profit { get; set; }

    /// <summary>
    /// 利润率
    /// </summary>
    public decimal ProfitRate { get; set; }

    /// <summary>
    /// 是否亏损
    /// </summary>
    public bool IsNegative { get; set; }
}

/// <summary>
/// 盒子利润统计列表请求
/// </summary>
public class BoxProfitListRequest : PagedRequest
{
    /// <summary>
    /// 盒子ID
    /// </summary>
    public int? GoodsId { get; set; }

    /// <summary>
    /// 盒子名称
    /// </summary>
    public string? Title { get; set; }

    /// <summary>
    /// 状态：0-下架，1-上架
    /// </summary>
    public int? Status { get; set; }

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

    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }

    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime? EndTime { get; set; }
}

/// <summary>
/// 盒子利润统计列表项
/// </summary>
public class BoxProfitItem
{
    /// <summary>
    /// 盒子ID
    /// </summary>
    public int Id { get; set; }

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

    /// <summary>
    /// 盒子图片
    /// </summary>
    public string? ImgUrl { get; set; }

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

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

    /// <summary>
    /// 状态：0-下架，1-上架
    /// </summary>
    public int Status { get; set; }

    /// <summary>
    /// 状态名称
    /// </summary>
    public string StatusName => Status == 1 ? "上架" : "下架";

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

    /// <summary>
    /// 类型名称
    /// </summary>
    public string TypeName { get; set; } = string.Empty;

    /// <summary>
    /// 消费金额
    /// </summary>
    public decimal UseMoney { get; set; }

    /// <summary>
    /// 出货成本
    /// </summary>
    public decimal ScMoney { get; set; }

    /// <summary>
    /// 兑换成本
    /// </summary>
    public decimal ReMoney { get; set; }

    /// <summary>
    /// 发货成本
    /// </summary>
    public decimal FhMoney { get; set; }

    /// <summary>
    /// 抽奖次数
    /// </summary>
    public int CjCount { get; set; }

    /// <summary>
    /// 利润
    /// </summary>
    public decimal Profit { get; set; }

    /// <summary>
    /// 利润率
    /// </summary>
    public decimal ProfitRate { get; set; }

    /// <summary>
    /// 是否亏损
    /// </summary>
    public bool IsNegative { get; set; }

    /// <summary>
    /// 是否已加载统计数据
    /// </summary>
    public bool Loaded { get; set; }
}

/// <summary>
/// 盒子利润汇总
/// </summary>
public class BoxProfitSummary
{
    /// <summary>
    /// 总收入
    /// </summary>
    public decimal TotalIncome { get; set; }

    /// <summary>
    /// 总成本
    /// </summary>
    public decimal TotalCost { get; set; }

    /// <summary>
    /// 总利润
    /// </summary>
    public decimal TotalProfit { get; set; }

    /// <summary>
    /// 总兑换金额
    /// </summary>
    public decimal TotalReMoney { get; set; }

    /// <summary>
    /// 总发货金额
    /// </summary>
    public decimal TotalFhMoney { get; set; }

    /// <summary>
    /// 总抽奖次数
    /// </summary>
    public int TotalCjCount { get; set; }

    /// <summary>
    /// 利润率
    /// </summary>
    public decimal ProfitRate { get; set; }

    /// <summary>
    /// 是否亏损
    /// </summary>
    public bool IsNegative { get; set; }
}

/// <summary>
/// 盒子汇总统计请求
/// </summary>
public class BoxSummaryStatisticsRequest
{
    /// <summary>
    /// 盒子ID
    /// </summary>
    public int? GoodsId { get; set; }

    /// <summary>
    /// 盒子名称
    /// </summary>
    public string? Title { get; set; }

    /// <summary>
    /// 状态：0-下架，1-上架
    /// </summary>
    public int? Status { get; set; }

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

    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }

    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime? EndTime { get; set; }
}
