package com.qmth.distributed.print.business.service;

import com.google.gson.Gson;
import com.qmth.distributed.print.business.bean.flow.CustomFlowSaveDto;
import com.qmth.distributed.print.business.bean.result.FlowInfoResult;
import com.qmth.distributed.print.business.bean.result.FlowTaskResult;
import com.qmth.distributed.print.business.bean.result.FlowViewResult;
import com.qmth.distributed.print.business.bean.result.TaskInfoResult;
import com.qmth.teachcloud.common.enums.TFCustomTypeEnum;
import org.activiti.engine.runtime.ProcessInstance;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @Description: activiti service
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2021/7/12
 */
public interface ActivitiService {

    /**
     * 启动流程
     *
     * @param map
     */
    public ProcessInstance flowStart(Map<String, Object> map);

    /**
     * 流程终止
     *
     * @param flowId
     */
    public void flowEnd(String flowId);

    /**
     * 审批任务
     *
     * @param map
     */
    public Map<String, Object> taskApprove(Map<String, Object> map);

    /**
     * 获取所有流程节点
     *
     * @param flowId
     * @return
     */
    public List<FlowTaskResult> getTaskAll(String flowId);

    /**
     * 流程节点转他人审批
     *
     * @param userId
     * @param taskId
     * @return
     */
    public boolean taskApproverExchange(String userId, String taskId);

    /**
     * 动态创建流程图
     *
     * @param customFlowSaveDto
     * @param id
     * @param version
     * @return
     * @throws IOException
     */
    public Map<String, Object> dynamicBuildBpmn(CustomFlowSaveDto customFlowSaveDto, String id, Integer version) throws IOException;

    /**
     * 启动自定义流程
     *
     * @param map
     */
    public Map<String, Object> customFlowStart(Map<String, Object> map);

    /**
     * 获取当前流程节点信息
     *
     * @param taskId
     * @return
     */
    public TaskInfoResult getTaskInfo(Long taskId);

    /**
     * 获取当前流程信息
     *
     * @param flowId
     * @return
     */
    public FlowViewResult getFlowView(Long flowId);

    /**
     * 根据流程类型获取流程节点
     *
     * @param type
     * @param flowId
     * @return
     */
    public FlowInfoResult getFlowInfoByType(TFCustomTypeEnum type, Long flowId);

    /**
     * 获取下级审核节点
     *
     * @param setupMap
     * @param gson
     * @param currSetup
     * @param nextFlowTaskResult
     * @return
     */
    public FlowTaskResult getNextFlowTaskResult(Map<String, FlowTaskResult> setupMap,
                                                Gson gson,
                                                int currSetup,
                                                FlowTaskResult nextFlowTaskResult);
}
