
using Hotline.Share.Dtos.File;
using Hotline.Share.Enums.JudicialManagement;
using Hotline.Share.Enums.Order;
using SqlSugar;
using System.ComponentModel;
using XF.Domain.Repository;

namespace Hotline.ContingencyManagement
{
    /// <summary>
    /// 宜宾应急管理局工单数据
    /// </summary>
    [Description("宜宾应急管理局工单数据")]
    public class ContingencyManagementOrders : PositionEntity
    {
        /// <summary>
        /// 来源渠道（电话、网站、APP等）
        /// </summary>
        public string? SourceChannel { get; set; }

        public string? SourceChannelCode { get; set; }

        /// <summary>
        /// 来电号码
        /// </summary>
        public string? FromPhone { get; set; }

        /// <summary>
        /// 转接号码（转接来源）
        /// </summary>
        public string? TransferPhone { get; set; }

        /// <summary>
        /// 来电/信人姓名
        /// </summary>
        public string? FromName { get; set; }

        /// <summary>
        /// 来电/信人性别
        /// </summary>
        public EGender FromGender { get; set; }

        /// <summary>
        /// 来电/信人身份
        /// </summary>
        public EIdentityType? IdentityType { get; set; }

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

        [SugarColumn(ColumnDescription = "联系电话脱敏", IsNullable = true)]
        public string? ContactMask { get; set; }

        /// <summary>
        /// 受理类型
        /// </summary>
        public string? AcceptType { get; set; }

        public string? AcceptTypeCode { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 热点
        /// </summary>
        public string? HotspotId { get; set; }

        public string? HotspotName { get; set; }

        public string? HotspotSpliceName { get; set; }

        /// <summary>
        /// 外部数据（为前端提供级联功能）
        /// </summary>
        public string? HotspotExternal { get; set; }

        /// <summary>
        /// 附件
        /// </summary>
        [SugarColumn(ColumnDataType = "json", IsJson = true)]
        public List<FileDto>? Additions { get; set; } = new();

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

        /// <summary>
        /// 工单编码（20220101000001）
        /// </summary>
        public string? No { get; set; }

        /// <summary>
        /// 市民查询密码
        /// </summary>
        public string? Password { get; set; }

        /// <summary>
        /// 受理人id
        /// </summary>
        public string? AcceptorId { get; set; }

        /// <summary>
        /// 受理人名称
        /// </summary>
        public string? AcceptorName { get; set; }

        /// <summary>
        /// 受理人工号
        /// </summary>
        public string? AcceptorStaffNo { get; set; }

        /// <summary>
        /// 受理人部门编码
        /// </summary>
        public string? AcceptorOrgCode { get; set; }

        /// <summary>
        /// 受理人部门名称
        /// </summary>
        public string? AcceptorOrgName { get; set; }

        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
        public List<FileJson>? FileJson { get; set; }

        /// <summary>
        /// 工单来源
        /// </summary>
        public EOrderSoure? OrderSoure { get; set; }

        /// <summary>
        /// 归档时间（暂为流程结束时间，因流程结束自动归档）
        /// </summary>
        public DateTime? FiledTime { get; set; }

        /// <summary>
        /// 归档意见
        /// </summary>
        [SugarColumn(ColumnDataType = "varchar(8000)")]
        public string? FileOpinion { get; set; }

        /// <summary>
        /// 实际办理时间
        /// </summary>
        public DateTime? ActualHandleTime { get; set; }

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

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

        /// <summary>
        /// 实际办理部门名称
        /// </summary>
        public string? ActualHandleOrgName { get; set; }

        /// <summary>
        /// 实际办理部门编码
        /// </summary>
        public string? ActualHandleOrgCode { get; set; }

        /// <summary>
        /// 实际办理意见（办理中...or 最终办理意见）
        /// </summary>
        [SugarColumn(Length = 8000)]
        public string ActualOpinion { get; set; } = "办理中...";

        /// <summary>
        /// 整理标题
        /// </summary>
        public string ArrangeTitle { get; set; }

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

        /// <summary>
        /// 整理后办理意见
        /// </summary>
        [SugarColumn(Length = 8000)]
        public string? ArrangementOpinion { get; set; }

        /// <summary>
        /// 推送状态 0：推送中，1：成功，2：失败
        /// </summary>        
        [SugarColumn(DefaultValue = "0")]
        public string? PushState { get; set; }
    }
}
