using APT.BaseData.Domain.ApiModel;
using APT.BaseData.Domain.Entities;
using APT.Infrastructure.Core;
using System;
using System.Collections.Generic;
using APT.Infrastructure.Api;
namespace APT.BaseData.Domain.IServices.FM
{
    public partial interface IPFFlowService : ICommonService
    {
        void SendFlowAndCommit<T>(T entity, int entityType, string schemeCode, Action action) where T : MesEntityBase, new();
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="pageFilter"></param>
        /// <returns></returns>
        PagedResultDto<T_PF_FLOW_INSTANCE> QueryFlowInstance(KeywordPageFilter pageFilter);
        /// <summary>
        /// 新增时自动送审
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        void AddAndSendFlow<T>(T entity, int entityType) where T : MesEntityBase, new();

        /// <summary>
        /// 检查自动送审(直接保存数据）
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <param name="entityType">实体类型 参考PFCodeRuleType</param>
        void CheckAndSendFlow<T>(Guid id, int entityType) where T : MesEntityBase, new();

        /// <summary>
        /// 检查自动送审(直接保存数据）
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <param name="entityType">实体类型 参考PFCodeRuleType</param>
        /// <param name="userId"></param>
        /// <param name="userName"></param>
        void CheckAndSendFlow<T>(Guid id, int entityType, string userId, string userName) where T : MesEntityBase, new();

        /// <summary>
        /// 检查自动送审（未保存数据）
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        /// <param name="entityType">实体类型 参考PFCodeRuleType</param>
        /// <returns>可能为空</returns>
        SendFlowResult<T> CheckAndSendFlow<T>(T entity, int entityType) where T : MesEntityBase, new();


        /// <summary>
        /// 送审(直接保存数据）
        /// </summary>
        /// <param name="id">实体ID</param>
        /// <param name="entityType">实体类型 参考PFCodeRuleType</param>
        /// <returns></returns>
        void SendFlow<T>(Guid id, int entityType) where T : MesEntityBase, new();
        /// <summary>
        /// 送审(直接保存数据）
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id">实体ID</param>
        /// <param name="entityType">实体类型 参考PFCodeRuleType</param>
        /// <param name="userId"></param>
        /// <param name="userName"></param>
        void SendFlow<T>(Guid id, int entityType, string userId, string userName) where T : MesEntityBase, new();

        /// <summary>
        /// 送审(直接保存数据）
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        SendFlowResult<T> SendFlow<T>(SendFlowParam param, Action action = null) where T : MesEntityBase, new();
        /// <summary>
        /// 送审(未保存数据）
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        SendFlowResult<T> SendFlow<T>(SendFlowEntityParam<T> param) where T : MesEntityBase, new();
        /// <summary>
        /// 审核流程
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        void PermitFlow<T>(PermitFlowParam param) where T : MesEntityBase, new();

        /// <summary>
        /// 审核流程
        /// </summary>
        /// <param name="param"></param>
        void PermitFlowSimple(PermitFlowParam param);

        /// <summary>获取流程模板</summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        FlowSchemeResponse GetFlowScheme(KeywordFilter filter);

        /// <summary>
        /// 获取流程
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        FlowResponse GetFlow(KeywordFilter filter);
    }
}