using System;
using SqlSugar;

namespace MDL.Models
{
    /// <summary>
    /// 扫描结果枚举
    /// </summary>
    public enum ScanResult
    {
        /// <summary>
        /// 已返回面单
        /// </summary>
        ReturnedLabel = 0,
        
        /// <summary>
        /// 无面单数据
        /// </summary>
        NoLabelData = 1,
        
        /// <summary>
        /// 无下单数据
        /// </summary>
        NoOrderData = 2,
        
        /// <summary>
        /// 订单被冻结
        /// </summary>
        OrderFrozen = 3,
        
        /// <summary>
        /// 订单已销毁
        /// </summary>
        OrderDestroyed = 4,
        
        /// <summary>
        /// 其他
        /// </summary>
        Other = 5
    }
    
    /// <summary>
    /// 标签历史扫描记录实体类，映射到数据库表
    /// </summary>
    [SugarTable("label_scan_history")]
    public class LabelScanEntity
    {
        /// <summary>
        /// 主键ID，自增
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }
        
        /// <summary>
        /// 客户ID
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public int CustomerId { 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>
        /// 扫描结果
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public ScanResult Result { get; set; }
        
        /// <summary>
        /// 描述
        /// </summary>
        [SugarColumn(Length = 500)]
        public string? Description { get; set; }
        
        /// <summary>
        /// 创建人
        /// </summary>
        [SugarColumn(Length = 100)]
        public string? CreatedBy { get; set; }

        [SugarColumn(Length = 64)]
        public string? DeviceCode { get; set; }

        [SugarColumn(Length = 100)]
        public string? DeviceName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
        
        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
    }
}