using DataSharing.Share.Dtos;
using DataSharing.Share.Enums;
using SqlSugar;
using System.ComponentModel;
using XF.Domain.Repository;

namespace DataSharing.RawData
{
    /// <summary>
    /// 工单基础数据数据
    /// </summary>
    [Description("工单基础数据数据")]
    public class DsOrder : CreationEntity
    {
        /// <summary>
        /// 工单id
        /// </summary>
        [SugarColumn(ColumnDescription = "工单ID", ColumnDataType = "varchar(50)")]
        public string OrderId { get; set; }

        /// <summary>
        /// 工单编号
        /// </summary>
        [SugarColumn(ColumnDescription = "工单编号", ColumnDataType = "varchar(50)")]
        public string OrderNo { get; set; }

        /// <summary>
        /// 流程ID
        /// </summary>
        [SugarColumn(ColumnDescription = "流程ID", ColumnDataType = "varchar(50)")]
        public string? WorkflowId { get; set; }

        /// <summary>
        /// 上传省工单编号
        /// </summary>
        [SugarColumn(ColumnDescription = "上传省工单编号", ColumnDataType = "varchar(50)")]
        public string? ProvinceNo { get; set; }

        /// <summary>
        /// 外部编号
        /// </summary>
        [SugarColumn(ColumnDescription = "外部编号", ColumnDataType = "varchar(50)")]
        public string? ExternalId { get; set; }

        /// <summary>
        /// 信件查询密码
        /// </summary>
        [SugarColumn(ColumnDescription = "信件查询密码", ColumnDataType = "varchar(20)")]
        public string? Password { get; set; }

        /// <summary>
        /// 工单标题
        /// </summary>
        [SugarColumn(ColumnDescription = "工单标题", ColumnDataType = "varchar(500)")]
        public string Title { get; set; }

        /// <summary>
        /// 来电/信人姓名
        /// </summary>
        [SugarColumn(ColumnDescription = "来电/信人姓名", ColumnDataType = "varchar(20)")]
        public string FromName { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        [SugarColumn(ColumnDescription = "联系电话", ColumnDataType = "varchar(30)")]
        public string? Contact { get; set; }

        /// <summary>
        /// 诉求内容
        /// </summary>
        [SugarColumn(ColumnDescription = "诉求内容", ColumnDataType = "text")]
        public string Content { get; set; }

        /// <summary>
        /// 受理时间
        /// </summary>
        [SugarColumn(ColumnDescription = "受理时间", IsNullable = true)]
        public DateTime? CaseDate { get; set; }

        /// <summary>
        /// 流程开启时间
        /// </summary>
        [SugarColumn(ColumnDescription = "流程开启时间", IsNullable = true)]
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 通话记录ID(来源为电话的有值)
        /// </summary>
        [SugarColumn(ColumnDescription = " 通话记录ID(来源为电话的有值)", IsNullable = true)]
        public string? CallId { get; set; }

        /// <summary>
        /// 第一次上传省上的时间
        /// </summary>
        [SugarColumn(ColumnDescription = "第一次上传省上的时间", IsNullable = true)]
        public DateTime? FirstSendProvinceTime { get; set; }

        /// <summary>
        /// 最近一次推送时间
        /// </summary>
        [SugarColumn(ColumnDescription = "最近一次推送时间", IsNullable = true)]
        public DateTime? LastSendProvinceTime { get; set; }

        /// <summary>
        ///   来源，区分省平台或110等其他平台同步过来的工单
        /// </summary>
        public string? Source { get; set; }

        /// <summary>
        /// 同步诉求渠道
        /// </summary>
        [SugarColumn(ColumnDescription = "同步诉求渠道")]
        public string? CaseSource { get; set; }

        /// <summary>
        /// 同步诉求渠道编码
        /// </summary>
        [SugarColumn(ColumnDescription = "同步诉求渠道编码")]
        public string? CaseSourceCode { get; set; }

        /// <summary>
        /// 热点Id
        /// </summary>
        [SugarColumn(ColumnDescription = "热点Id")]
        public string? HotspotId { get; set; }

        /// <summary>
        /// 热点名称
        /// </summary>
        [SugarColumn(ColumnDescription = "热点名称")]
        public string? HotspotName { get; set; }

        /// <summary>
        /// 热点全称
        /// </summary>
        [SugarColumn(ColumnDescription = "热点全称")]
        public string? HotspotSpliceName { get; set; }

        /// <summary>
        /// 最新应办结时间
        /// </summary>
        [SugarColumn(ColumnDescription = "最新应办结时间", IsNullable = true)]
        public DateTime? ExpiredTime { get; set; }

        /// <summary>
        /// 受理类型名称
        /// </summary>
        [SugarColumn(ColumnDescription = "受理类型名称", IsNullable = true)]
        public string? CaseType { get; set; }

        /// <summary>
        /// 受理类型Code
        /// </summary>
        [SugarColumn(ColumnDescription = "受理类型Code", IsNullable = true)]
        public string? CaseTypeCode { get; set; }

        /// <summary>
        /// 办理时长
        /// </summary>
        [SugarColumn(ColumnDescription = "办理时长", IsNullable = true)]
        public double? AllDuration { get; set; } = 0;

        /// <summary>
        /// 是否为省工单
        /// </summary>
        [SugarColumn(ColumnDescription = "是否为省工单")]
        public bool IsProvince { get; set; } = false;

        /// <summary>
        /// 办理状态--默认办理中，归档的时候更新为办理完成
        /// </summary>
        [SugarColumn(ColumnDescription = "办理状态--默认办理中，归档的时候更新为办理完成", IsNullable = true)]
        public string? HandleState { get; set; } = "办理中";

        /// <summary>
        /// 实际办理人Code
        /// </summary>
        public string? ActualHandlerId { get; set; }

        /// <summary>
        /// 实际办理人名称
        /// </summary>
        public string? ActualHandlerName { get; set; }

        /// <summary>
        /// 实际办理部门名称
        /// </summary>
        [SugarColumn(ColumnDescription = "实际办理部门名称", IsNullable = true)]
        public string? ActualHandleOrgName { get; set; }

        /// <summary>
        /// 实际办理部门编码
        /// </summary>
        [SugarColumn(ColumnDescription = "实际办理部门编码", IsNullable = true)]
        public string? ActualHandleOrgCode { get; set; }

        /// <summary>
        /// 实际办理意见
        /// </summary>
        [SugarColumn(ColumnDescription = "实际办理意见", IsNullable = true, ColumnDataType = "text")]
        public string? ActualOpinion { get; set; }

        /// <summary>
        /// 办结时间--归档的时间
        /// </summary>
        [SugarColumn(ColumnDescription = "办结时间--归档的时间", IsNullable = true)]
        public DateTime? ActualHandleTime { get; set; }

        /// <summary>
        /// 是否公开---工单发布的时候选择是否公开
        /// </summary>
        [SugarColumn(ColumnDescription = "是否公开---工单发布的时候选择是否公开", IsNullable = true)]
        public EDsPublishState IsPublish { get; set; } = EDsPublishState.Unpublished;

        /// <summary>
        ///发布时间
        /// </summary>
        [SugarColumn(ColumnDescription = "发布时间", IsNullable = true)]
        public DateTime? PublishDate { get; set; }

        /// <summary>
        /// 整理标题
        /// </summary>
        [SugarColumn(ColumnDescription = "整理标题", IsNullable = true)]
        public string? ArrangeTitle { get; set; }

        /// <summary>
        /// 整理内容
        /// </summary>
        [SugarColumn(ColumnDescription = "整理内容", IsNullable = true, ColumnDataType = "varchar(8000)")]
        public string? ArrangeContent { get; set; }

        /// <summary>
        /// 整理结果
        /// </summary>
        [SugarColumn(ColumnDescription = "整理结果", IsNullable = true, ColumnDataType = "varchar(8000)")]
        public string? ArrangeOpinion { get; set; }

        /// <summary>
        /// 是否可以评价
        /// </summary>
        [SugarColumn(ColumnDescription = "是否可以评价", IsNullable = true)]
        public EVisitTypeState VisitTypeState { get; set; } = EVisitTypeState.UnVisit;

        /// <summary>
        /// 受理地址
        /// </summary>
        [SugarColumn(ColumnDescription = "受理地址", IsNullable = true)]
        public string? FullAddress { get; set; }

        /// <summary>
        /// 附件
        /// </summary>
        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
        public List<Hotline.Share.Dtos.File.FileJson>? FileJson { get; set; }

        /// <summary>
        /// 区域
        /// </summary>
        [SugarColumn(ColumnDescription = "区域", IsNullable = true)]
        public string? AreaCode { get; set; }
    }
}
