using OpenAuth.App.Config;
using OpenAuth.Repository.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenAuth.App
{
    public interface IWFEngine
    {
        /// <summary>
        /// 开始节点
        /// </summary>
        WFUnit StartNode { get; }

        /// <summary>
        /// 流程运行参数
        /// </summary>
        WFEngineConfig Config { get; }


        /// <summary>
        /// 流程发起用户
        /// </summary>
        WFUserInfo CreateUser { get; }


        /// <summary>
        /// 流程配置信息
        /// </summary>
        WorkFlow.WFScheme WFScheme { get; }

        /// <summary>
        /// 获取流程单元信息
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>流程单元信息</returns>
        WFUnit GetNode(string id);

        /// <summary>
        /// 获取下一节点集合
        /// </summary>
        /// <param name="startId">开始节点</param>
        /// <param name="code">执行动作编码</param>
        /// <returns></returns>
        List<WFUnit> GetNextUnits(string startId, string code = "");

        /// <summary>
        /// 获取任务
        /// </summary>
        /// <param name="startId">开始节点</param>
        /// <param name="code">执行动作编码</param>
        /// <param name="toUnitId">下一个指定节点</param>
        /// <returns></returns>
        Task<List<WorkFlow.WFTask>> GetTask(string startId, string code = "", string toUnitId = "");
    }
}
