using System;
using SqlSugar;

namespace MDL.Models
{
    /// <summary>
    /// 标签替换实体类，映射到数据库表
    /// </summary>
    [SugarTable("label_replace_requests")]
    public class LabelReplaceEntity
    {
        /// <summary>
        /// 主键ID，自增
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }
        
        /// <summary>
        /// 提单号
        /// </summary>
        [SugarColumn(Length = 100)]
        public string? BillOfLadingNumber { get; set; }
        
        /// <summary>
        /// 大包号
        /// </summary>
        [SugarColumn(Length = 100)]
        public string? MasterPackageNumber { get; set; }
        
        /// <summary>
        /// 参考号（一般表示订单号）
        /// </summary>
        [SugarColumn(Length = 100)]
        public string? ReferenceNumber { get; set; }
        
        /// <summary>
        /// 中性面单单号（必填）
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = false)]
        public string NeutralWaybillNumber { get; set; }
        
        /// <summary>
        /// 尾程跟踪单号
        /// </summary>
        [SugarColumn(Length = 100)]
        public string? FinalMileTrackingNumber { get; set; }
        
        /// <summary>
        /// 客户ID（关联customers表）
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int? CustomerId { get; set; }
        
        /// <summary>
        /// 标签内容（一般为PDF，可能是base64或其他格式）
        /// </summary>
        [SugarColumn(ColumnDataType = "longtext")]
        public string? Label { get; set; }
        
        /// <summary>
        /// 换单状态（Y表示正常换单，N表示冻结换单）
        /// </summary>
        [SugarColumn(Length = 1, DefaultValue = "Y")]
        public string ReplaceStatus { get; set; } = "Y";
        
        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
        
        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
        
        /// <summary>
        /// 获取标签时间
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime? LabelRetrievedAt { get; set; }
    }
}