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

namespace Hotline.Share.Dtos.FlowEngine.Workflow;

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

    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 配置下一步节点 & 谁被选中
    /// </summary>
    public List<StepSimple> NextSteps { get; set; } = new();

    /// <summary>
    /// 前一级节点Id(stepBox此字段为上级stepBoxId,step为上级stepId),汇总节点无此字段（因可能有多个上级来源）
    /// </summary>
    public string? PrevStepId { get; set; }
    public string? PrevStepCode { get; set; }

    /// <summary>
    /// 主办
    /// </summary>
    public bool IsMain { get; set; }

    /// <summary>
    /// 节点办理状态
    /// </summary>
    public EWorkflowStepStatus Status { get; set; }

    /// <summary>
    /// 原生节点（区别动态生成）
    /// </summary>
    public bool IsOrigin { get; set; }


    #region 会签
    
    /// <summary>
    /// 会签id（或外层会签的id）
    /// </summary>
    public string? CountersignId { get; set; }

    /// <summary>
    /// 节点处于会签流程中的位置（区别直接办理会签和会签内非会签节点）
    /// 最顶层的发起会签节点为none
    /// </summary>
    public ECountersignPosition CountersignPosition { get; set; }

    #region 发起会签节点特有

    /// <summary>
    /// 发起会签生成会签Id（不发起会签节点无此字段）
    /// </summary>
    public string? StartCountersignId { get; set; }

    /// <summary>
    /// 会签直属办理节点
    /// </summary>
    public List<CountersignStep> CountersignSteps { get; set; } = new();

    /// <summary>
    /// 发起的会签是否汇总
    /// </summary>
    public bool IsStartedCountersignEnd { get; set; }

    #endregion

    #region 会签汇总节点特有

    /// <summary>
    /// 是否为会签汇总节点
    /// </summary>
    public bool IsCountersignEndStep { get; set; }

    /// <summary>
    /// 开启会签节点id（会签汇总节点对应会签发起节点id）
    /// </summary>
    public string? CountersignStartStepId { get; set; }

	#endregion

	#endregion


	/// <summary>
	/// 接办时间
	/// </summary>
	public DateTime? AcceptTime { get; set; }

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

	public string? AcceptorOrgName { get; set; }

	public string? CreatorOrgId { get; set; }

	public string? CreatorOrgName { get; set; }
}