using Hotline.Share.Enums.FlowEngine;
using Hotline.Share.Enums.Settings;

namespace Hotline.Share.Dtos.FlowEngine.Workflow;

/// <summary>
/// 工作流流转基础信息
/// </summary>
public class BasicWorkflowDto : EndWorkflowDto
{
    /// <summary>
    /// 下一节点code(defineStep.code)
    /// </summary>
    public string NextStepCode { get; set; } = string.Empty;
    public string NextStepName { get; set; } = string.Empty;

    /// <summary>
    /// 是否回到会签发起节点汇总
    /// </summary>
    public bool BackToCountersignEnd { get; set; }

    public EFlowDirection? FlowDirection { get; set; }
    
    #region currentStepInfo

    /// <summary>
    /// 办理对象类型
    /// </summary>
    public EHandlerType HandlerType { get; set; }

    /// <summary>
    /// 节点类型
    /// </summary>
    public EStepType StepType { get; set; }

    /// <summary>
    /// 模板配置节点业务类型
    /// </summary>
    public EBusinessType BusinessType { get; set; }

    /// <summary>
    /// 发起会签
    /// </summary>
    public bool IsStartCountersign { get; set; }

    /// <summary>
    /// 当前节点tag
    /// </summary>
    public string CurrentTag { get; set; }

    #endregion

    /// <summary>
    /// 根据办理者类型不同，此字段为不同内容
    /// <example>
    /// 部门等级/分类为：depCodes, 角色为：userIds
    /// </example>
    /// </summary>
    public List<StepAssignInfo> NextHandlers { get; set; } = new();

    /// <summary>
    /// 指派办理类型
    /// </summary>
    public EFlowAssignType? FlowAssignType { get; set; }

    /// <summary>
    /// 是否短信通知
    /// </summary>
    public bool IsSms { get; set; }

    /// <summary>
    /// 下一节点主办
    /// </summary>
    public string? NextMainHandler { get; set; }

    /// <summary>
    /// 外部业务参数
    /// </summary>
    public External External { get; set; }

    /// <summary>
    /// 审核结果（非审批流程无意义）
    /// </summary>
    public EReviewResult ReviewResult { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    public string? Remark { get; set; }

    /// <summary>
    /// 话务提醒是否转办
    /// </summary>
    public bool? IsForwarded { get; set; }
}

public class External
{
    public int? TimeLimit { get; set; }
    public ETimeType? TimeLimitUnit { get; set; }

    /// <summary>
    /// 警情退回
    /// </summary>
    public bool IsPoliceReturn { get; set; }

    /// <summary>
    /// 部门是否解决
    /// </summary>
    public bool IsResolved { get; set; }
}