using APT.BaseData.Domain.Entities;
using APT.BaseData.Domain.Entities.FM;
using APT.BaseData.Domain.Enums;
using APT.Infrastructure.Core;
using APT.MS.Domain.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace APT.MS.Domain.Entities.CM
{
    /// <summary>
    /// 潜在紧急事件
    /// </summary>
    [Description("潜在紧急事件")]
    [DataRuleField("DEPARTMENT_ID")]
    public class T_CM_URGENT_EVENT : MesEntityBase
    {
        /// <summary>
        /// 编号
        /// </summary>
        [Description("编号")]
        [FormFieldTable]
        [FormFieldEdit]
        [FormFieldQuery]
        [DataFieldLength(50)]
        [CUnique]
        [CodeRule((int)PFCodeRuleType.应急管理)]
        public string CODE { get; set; }

        /// <summary>
        /// 发起部门ID
        /// </summary>
        [Description("发起部门")]
        [DataFieldForeignKey("Nav_Department")]
        public Guid? DEPARTMENT_ID { get; set; }

        /// <summary>
        /// 导航属性：发起部门
        /// </summary>
        [Description("导航属性：发起部门")]
        [FormFieldEdit]
        [FormFieldTable]
        [FormFieldQuery]
        public T_FM_DEPARTMENT Nav_Department { get; set; }

        /// <summary>
        /// 发起人
        /// </summary>
        [Description("发起人")]
        [DataFieldForeignKey("Nav_User")]
        public Guid? USER_ID { get; set; }

        /// <summary>
        /// 导航属性：发起人
        /// </summary>
        [Description("导航属性：发起人")]
        [FormFieldEdit]
        [FormFieldTable]
        [FormFieldQuery]
        public T_FM_USER Nav_User { get; set; }

        /// <summary>
        /// 事件类型ID
        /// </summary>
        [Description("事件类型")]
        [FormFieldTable]
        [FormFieldEdit]
        [FormFieldQuery]
        [DataFieldForeignKey("Nav_EventType")]
        public Guid EVENT_TYPE_ID { get; set; }

        /// <summary>
        /// 导航属性：事件类型
        /// </summary>
        [Description("导航属性：事件类型")]
        [FormFieldEdit]
        public T_CM_EVENT_TYPE Nav_EventType { get; set; }

        /// <summary>
        /// 预计影响范围
        /// </summary>
        [Description("预计影响范围")]
        [DataFieldIngore]
        public string AREARINFLUENCE { get; set; }

        /// <summary>
        /// 导航属性：预计影响范围
        /// </summary>
        [Description("导航属性：预计影响范围")]
        [FormFieldEdit]
        public ICollection<T_CM_URGENT_AREAR_INFLUENCE> Nav_ListArearInfluence { get; set; }

        /// <summary>
        /// 预计影响范围
        /// </summary>
        [Description("预计影响范围描述")]
        [FormFieldTable]
        [FormFieldEdit]
        [FormFieldQuery]
        [DataFieldLength(500)]
        public string AREAR_INFLUENCE { get; set; }

        /// <summary>
        /// 影响地点
        /// </summary>
        [Description("影响地点")]
        [FormFieldTable]
        [FormFieldEdit]
        [FormFieldQuery]
        [DataFieldLength(300)]
        public string ADDRESS_INFLUENCE { get; set; }

        /// <summary>
        /// 生成方式
        /// </summary>
        [Description("生成方式")]
        public CREACTTYPEEnum CREACTTYPE { get; set; } = CREACTTYPEEnum.UserAdd;

        /// <summary>
        /// 启用标志
        /// </summary>
        [Description("启用标志")]
        [FormFieldTable]
        [FormFieldEdit]
        public FMEnableStatusEnum ENABLE_STATUS { get; set; }

        /// <summary>
        /// 事故后果
        /// </summary>
        [Description("事故后果")]
        [FormFieldTable]
        [FormFieldEdit]
        [FormFieldQuery]
        [DataFieldLength(500)]
        public string ACCIDENT_CONSEQUENCE { get; set; }

        /// <summary>
        /// 风险类别
        /// </summary>
        [Description("风险类别")]
        [DataFieldIngore]
        public string RISKTYPE { get; set; }

        /// <summary>
        /// 导航属性：风险类别
        /// </summary>
        [Description("导航属性：风险类别")]
        [FormFieldEdit]
        public ICollection<T_CM_URGENT_EVENT_RISK_TYPE> Nav_ListEventRiskType { get; set; }


        /// <summary>
        /// 导航属性：预案类型(子表)
        /// </summary>
        [Description("导航属性：预案类型")]
        [FormFieldEdit]
        public ICollection<T_CM_URGENT_EVENT_CONTINGENCY_PLAN> Nav_ListEventContingencyPlan { get; set; }
    }
}
