namespace HoneyBox.Admin.Business.Models.Order;

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

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

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

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

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

    /// <summary>
    /// 发货状态：0待支付，1待发货，2已发货，3已签收，4已取消
    /// </summary>
    public int? Status { get; set; }
}

/// <summary>
/// 发货订单响应
/// </summary>
public class ShippingOrderResponse
{
    /// <summary>
    /// 发货记录ID
    /// </summary>
    public int Id { get; set; }

    /// <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>
    /// 发货单号
    /// </summary>
    public string SendNum { get; set; } = string.Empty;

    /// <summary>
    /// 运费
    /// </summary>
    public decimal Freight { get; set; }

    /// <summary>
    /// 总价格（奖品价值总和）
    /// </summary>
    public decimal TotalPrice { get; set; }

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

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

    /// <summary>
    /// 发货奖品数量
    /// </summary>
    public int Count { get; set; }

    /// <summary>
    /// 收货人姓名
    /// </summary>
    public string? Name { get; set; }

    /// <summary>
    /// 收货人手机号
    /// </summary>
    public string? ReceiverMobile { get; set; }

    /// <summary>
    /// 收货地址
    /// </summary>
    public string? Address { get; set; }

    /// <summary>
    /// 留言备注
    /// </summary>
    public string? Message { get; set; }

    /// <summary>
    /// 快递单号
    /// </summary>
    public string? CourierNumber { get; set; }

    /// <summary>
    /// 快递公司名称
    /// </summary>
    public string? CourierName { get; set; }

    /// <summary>
    /// 快递公司编码
    /// </summary>
    public string? CourierCode { get; set; }

    /// <summary>
    /// 物流状态
    /// </summary>
    public int DeliveryStatus { get; set; }

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

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

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

    /// <summary>
    /// 发货时间
    /// </summary>
    public DateTime? SendTime { get; set; }

    /// <summary>
    /// 签收时间
    /// </summary>
    public DateTime? ReceiveTime { get; set; }

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

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

    /// <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 int GoodsType { get; set; }
}

/// <summary>
/// 发货请求
/// </summary>
public class ShipOrderRequest
{
    /// <summary>
    /// 快递公司名称
    /// </summary>
    public string CourierName { get; set; } = string.Empty;

    /// <summary>
    /// 快递单号
    /// </summary>
    public string CourierNumber { get; set; } = string.Empty;

    /// <summary>
    /// 快递公司编码（可选）
    /// </summary>
    public string? CourierCode { get; set; }
}

/// <summary>
/// 发货订单导出请求
/// </summary>
public class ShippingExportRequest
{
    /// <summary>
    /// 用户ID
    /// </summary>
    public int? UserId { get; set; }

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

    /// <summary>
    /// 发货单号
    /// </summary>
    public string? SendNum { 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 class ShippingExportDto
{
    /// <summary>
    /// 发货单号
    /// </summary>
    public string SendNum { 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>
    /// 收货人姓名
    /// </summary>
    public string? Name { get; set; }

    /// <summary>
    /// 收货人手机号
    /// </summary>
    public string? ReceiverMobile { get; set; }

    /// <summary>
    /// 收货地址
    /// </summary>
    public string? Address { get; set; }

    /// <summary>
    /// 发货奖品数量
    /// </summary>
    public int Count { get; set; }

    /// <summary>
    /// 运费
    /// </summary>
    public decimal Freight { get; set; }

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

    /// <summary>
    /// 快递公司名称
    /// </summary>
    public string? CourierName { get; set; }

    /// <summary>
    /// 快递单号
    /// </summary>
    public string? CourierNumber { get; set; }

    /// <summary>
    /// 留言备注
    /// </summary>
    public string? Message { get; set; }

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

    /// <summary>
    /// 发货时间
    /// </summary>
    public DateTime? SendTime { get; set; }
}

/// <summary>
/// 发货订单统计响应
/// </summary>
public class ShippingStatsResponse
{
    /// <summary>
    /// 总条数
    /// </summary>
    public int TotalCount { get; set; }

    /// <summary>
    /// 总价值（所有发货奖品的价值总和）
    /// </summary>
    public decimal TotalValue { get; set; }

    /// <summary>
    /// 本页总价值
    /// </summary>
    public decimal PageValue { get; set; }
}
