using Hotline.Share.Dtos.Order;
using Hotline.Share.Enums.FlowEngine;

namespace Hotline.Share.Dtos.FlowEngine.Workflow
{
    public class WorkflowCountersignDto
    {
        public string Id { get; set; }

        public DateTime CreationTime { get; set; }

        public string WorkflowId { get; set; }


        #region 发起会签

        /// <summary>
        /// 发起会签节点id（从开始节点直接发起的会签，该id和code为start节点的id与code）
        /// </summary>
        public string StartStepId { get; set; }

        //冗余
        public string StartStepCode { get; set; }

        /// <summary>
        /// 业务属性
        /// </summary>
        public EBusinessType StartStepBusiType { get; set; }

        /// <summary>
        /// 发起人
        /// </summary>
        public string StarterId { get; set; }

        public string StarterName { get; set; }

        /// <summary>
        /// 发起人部门code
        /// </summary>
        public string StarterOrgId { get; set; }

        public string? StarterOrgName { get; set; }

        /// <summary>
        /// 发起人部门行政区划代码
        /// </summary>
        public string StarterOrgAreaCode { get; set; }

        /// <summary>
        /// 发起人部门行政区划名称
        /// </summary>
        public string StarterOrgAreaName { get; set; }

        #endregion

        #region 结束会签

        /// <summary>
        /// 会签汇总节点id
        /// </summary>
        public string? EndStepId { get; set; }

        //冗余
        public string? EndStepCode { get; set; }

        /// <summary>
        /// 业务属性
        /// </summary>
        public EBusinessType EndStepBusiType { get; set; }

        /// <summary>
        /// 接办人
        /// </summary>
        public string? FinisherId { get; set; }

        public string? FinisherName { get; set; }

        /// <summary>
        /// 接办人部门code
        /// </summary>
        public string? FinisherOrgId { get; set; }

        public string? FinisherOrgName { get; set; }

        /// <summary>
        /// 接办人部门行政区划代码
        /// </summary>
        public string? FinisherOrgAreaCode { get; set; }

        /// <summary>
        /// 接办人部门行政区划名称
        /// </summary>
        public string? FinisherOrgAreaName { get; set; }

        /// <summary>
        /// 会签结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }


        #endregion

        /// <summary>
        /// 会签嵌套会签场景记录上级会签Id
        /// </summary>
        public string? ParentId { get; set; }

        /// <summary>
        /// 该会签参与成员数量
        /// </summary>
        public List<CountersignMember> Members { get; set; }

        /// <summary>
        /// 会签类型
        /// </summary>
        public ECounterSignType CounterSignType { get; set; }

        /// <summary>
        /// 发起会签节点设置的期满时间(冗余)
        /// </summary>
        public DateTime StartExpiredTime { get; set; }

        public OrderDto Order { get; set; }

        public string? StateText => EndTime.HasValue ? "已结束" : "未结束";

        /// <summary>
        /// 会签次数
        /// </summary>
        public int CounterSignCount { get; set; }
    }
}
