using System.ComponentModel;
using Hotline.Share.Dtos.Early;
using Hotline.Share.Dtos.FlowEngine;
using Hotline.Share.Dtos.FlowEngine.Workflow;
using Hotline.Share.Dtos.Order.OrderDelay;
using Hotline.Share.Dtos.Org;
using Hotline.Share.Enums.Early;
using Hotline.Share.Enums.FlowEngine;
using Hotline.Share.Enums.Settings;
using Hotline.Share.Enums.Snapshot;

namespace Hotline.Share.Dtos.Order
{
    /// <summary>
    /// 工单开启/办理流程dto
    /// </summary>
    public class OrderHandleFlowDto
    {
        public string OrderId { get; set; }

        /// <summary>
        /// 派单方式
        /// </summary>
        public EOrderAssignMode OrderAssignMode { get; set; }

        /// <summary>
        /// 跨级派单选择的节点
        /// </summary>
        public List<CrossStep> CrossSteps { get; set; }

        /// <summary>
        /// 协办部门
        /// </summary>
        public List<OrgDto> SecondaryOrgs { get; set; }

        /// <summary>
        /// 抄送对象
        /// </summary>
        public List<FlowStepHandler> Copys { get; set; }

        /// <summary>
        /// 是否直派
        /// </summary>
        public bool IsDirect{ get; set; }
        
        #region 手动填入办理人信息

        /// <summary>
        /// 真实办理人姓名（手动填写）
        /// </summary>
        public string? RealHandlerName { get; set; }

        /// <summary>
        /// 真实办理人电话（手动填写）
        /// </summary>
        public string? RealHandlerPhone { get; set; }

        /// <summary>
        /// 沟通方式（手动填写）
        /// </summary>
        public ERealCommunicationMode? RealCommunicationMode { get; set; }

        /// <summary>
        /// 沟通时间（手动填写）
        /// </summary>
        public DateTime? RealCommunicationTime { get; set; }

        /// <summary>
        /// 沟通地点（手动填写）
        /// </summary>
        public string? RealCommunicationAddress { get; set; }

        /// <summary>
        /// 已与市民沟通
        /// 已与市民电话联系，确认办理结果
        /// </summary>
        [Description("已与市民电话联系，确认办理结果")]
        public bool? RealIsContacted { get; set; }

        /// <summary>
        /// 已与市民现场沟通
        /// 已赴现场处置，将处理结果告知市民
        /// </summary>
        [Description("已赴现场处置，将处理结果告知市民")]
        public bool? RealContactLocale { get; set; }

        #endregion
        
        #region task_298

        /// <summary>
        /// 是否市州转办
        /// </summary>
        public bool? Transpond { get; set; }
        
        /// <summary>
        /// 其它
        /// </summary>
        [Description("其它")]
        public bool? IsOther { get; set; }

        /// <summary>
        /// 其它原因
        /// </summary>
        [Description("其它原因")]
        public string? OtherRemark { get; set; }

        /// <summary>
        /// 禅道_task_59
        /// 在办理的时候勾选的是否紧急
        /// </summary>
        public bool? IsStepUrgent { get; set; }

        /// <summary>
        /// 是否推诿
        /// </summary>
        public bool? IsEvasive { get; set; }

        /// <summary>
        /// 是否不积极
        /// </summary>
        public bool? IsInactively { get; set; }

        /// <summary>
        /// 领导短信Key
        /// </summary>
        public string? LeaderSMSKey { get; set; }

        /// <summary>
        /// 市州转办信息
        /// </summary>
        public string? TranspondCityName { get; set; }

        /// <summary>
        /// 市州转办信息
        /// </summary>
        public string? TranspondCityId { get; set; }

        /// <summary>
        /// 市州转办信息
        /// </summary>
        public string? TranspondCityValue { get; set; }

        #endregion

        #region 延期信息

        public int TimeLimit { get; set; }

        public ETimeType? TimeLimitUnit { get; set; }

        #endregion

        #region 随手拍业务

        /// <summary>
        /// 部门标记是否安全生产
        /// </summary>
        public bool? IsSafetyDepartment { get; set; }

        /// <summary>
        /// 合规类型
        /// </summary>
        public ECompliantType? CompliantType { get; set; }

        /// <summary>
        /// 部门是否存在安全隐患
        /// </summary>
        public bool? IsDangerDepartment { get; set; }

        /// <summary>
        /// 部门是否整改
        /// </summary>
        public bool? IsRectifyDepartment { get; set; }

        /// <summary>
        /// 线索分类Id
        /// </summary>
        public string? IndustryCase { get; set; }

        /// <summary>
        /// 是否补充奖励
        /// </summary>
        public bool? IsAward { get; set; }

        /// <summary>
        /// 补充奖励类型
        /// </summary>
        public string? ReplenishTypeId { get; set; }

        /// <summary>
        /// 补充奖励类型
        /// </summary>
        public string? ReplenishTypeName { get; set; }

        /// <summary>
        /// 追加奖励人姓名
        /// </summary>
        public string? AwardName { get; set; }

        /// <summary>
        /// 追加奖励人卡号
        /// </summary>
        public string? AwardBankCardNo { get; set; }

        /// <summary>
        /// 追加奖励金额(元)
        /// </summary>
        public double? AwardAmount { get; set; }

        /// <summary>
        /// 追加奖励人开户行
        /// </summary>
        public string? AwardOpenBank { get; set; }

        /// <summary>
        /// 核实方式
        /// </summary>
        public string? VerifyType { get; set; }

        /// <summary>
        /// 是否按清单检查
        /// </summary>
        public bool? IsCheckList { get; set; }

        #endregion

        #region 预警业务

        /// <summary>
        /// 派单选择预警
        /// </summary>
        public List<EarlyWarningSettingDto>? DispatchEarlyWarning { get; set; }


        #endregion
    }

    public class EarlyWarningSettingDto
    {
        public string Id { get; set; }

        /// <summary>
        /// 预警名称
        /// </summary>
        public string EarlyWarningName { get; set; }

        /// <summary>
        /// 预警级别值
        /// </summary>
        public string EarlyWarningLevelValue { get; set; }

        /// <summary>
        /// 预警级别名称
        /// </summary>
        public string EarlyWarningLevelName { get; set; }

        /// <summary>
        /// 预警类型值
        /// </summary>
        public string EarlyWarningTypeValue { get; set; }

        /// <summary>
        /// 预警类型名称
        /// </summary>
        public string EarlyWarningTypeName { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnable { get; set; }

        /// <summary>
        /// 预警原因
        /// </summary>
        public string EarlyWarningRemark { get; set; }

        /// <summary>
        /// 预警规则
        /// </summary>
        public List<EarlyWarningRuleDto> EarlyWarningRules { get; set; }

        /// <summary>
        /// 频率
        /// </summary>
        public EFrequency Frequency { get; set; }
    }


    public class CrossStep : BasicWorkflowDto
    {
        /// <summary>
        /// 办理顺序
        /// </summary>
        public int Sort { get; set; }
    }

    public enum EOrderAssignMode
    {
        /// <summary>
        /// 逐级
        /// </summary>
        AdjoinLevel = 0,

        /// <summary>
        /// 跨级
        /// </summary>
        CrossLevel = 1,

        /// <summary>
        /// 主协办
        /// </summary>
        MainAndSecondary = 2,
    }

    public class TerminateNextFlowDto
    {
        public OrderTerminateDto Data { get; set; }

        public NextWorkflowDto NextWorkflow { get; set; }
    }

    public class ScreenNextFlowDto
    {
        public OrderScreenDto Data { get; set; }

        public NextWorkflowDto NextWorkflow { get; set; }
    }

    public class DelayNextFlowDto
    {
        public OrderDelayDto Data { get; set; }

        public NextWorkflowDto NextWorkflow { get; set; }
    }

    public class BatchDelayNextFlowDto {

        public string[] DelayId { get; set; }
        
		public NextWorkflowDto NextWorkflow { get; set; }

		/// <summary>
		/// 是否通过
		/// </summary>
		public bool IsPass { get; set; }
	}
}