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

import com.qmth.teachcloud.common.enums.FlowApproveOperationEnum;
import org.activiti.bpmn.model.MultiInstanceLoopCharacteristics;
import org.activiti.bpmn.model.UserTask;

/**
 * @Description: 创建并行/串行业务
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2022/2/8
 */
public interface DefaultInstanceConvertToMultiInstance extends MultiWorkFlow {

    public static final String EXP_PREFIX = "${";
    public static final String EXP_SUFFIX = "}";
    public static final String EXP_EQUAL = "==";
    public static final String ASSIGNEE_USER = "assignee";
    public static final String DEFAULT_ASSIGNEE_LIST = "assigneeList";
    public static final String DEFAULT_ASSIGNEE_LIST_EXP = EXP_PREFIX + DEFAULT_ASSIGNEE_LIST;
    public static final String ASSIGNEE_USER_EXP = EXP_PREFIX + ASSIGNEE_USER;
    public static final String APPROVE_ID_EXP = EXP_PREFIX + "approveId" + EXP_SUFFIX;
    public static final String DEFAULT_USER_TASK = "_default";
    public static final String DEFAULT_USER_TASK_NAME = "提交申请";
    public static final String USER_TASK_APPROVE_NAME = "审核人";
    public static final String FLOW_BPMN_MODEL_NAME = "-dynamic-model.bpmn";
    public static final String FLOW_BPMN_PROCESS_NAME = "-multiple-process.bpmn";
    public static final String FLOW_BPMN_PNG_NAME = "-multiple-process-diagram.png";
    public static final String FLOW_BPMN_DEPLOYMENT_NAME = "-multiple process deployment";
    public static final String BPMN_NAME = "bpmn";
    public static final String GATEWAY_NAME = "gateway";
    public static final String SEQUENCE_NAME = "sequence";
    public static final String NR_OF_COMPLETED_INSTANCES = "nrOfCompletedInstances";
    public static final String NR_OF_INSTANCES = "nrOfInstances";
    public static final String REJECT_EXP = EXP_PREFIX + NR_OF_COMPLETED_INSTANCES + "/" + NR_OF_INSTANCES + EXP_EQUAL + 1 + " || " + FlowApproveOperationEnum.REJECT.getId();
    public static final String REJECT_EXP_SUFFIX = EXP_EQUAL + 1 + EXP_SUFFIX;

    /**
     * 创建多实例行为解释器
     *
     * @param userTask
     * @param sequential
     * @return
     */
    UserTask createMultiInstanceBehavior(UserTask userTask, boolean sequential);

    /**
     * 创建多实例行为解释器
     *
     * @param userTask        流程节点
     * @param sequential      是否串行
     * @param assigneeListExp 用户组表达
     * @param assigneeExp     用户标识
     * @return
     */
    UserTask createMultiInstanceBehavior(UserTask userTask, boolean sequential, String assigneeListExp, String assigneeExp);

    /**
     * 创建多实例循环解释器
     *
     * @param isSequential    是否串行
     * @param assigneeListExp 用户组表达
     * @param assignee        用户标识
     * @return
     */
    MultiInstanceLoopCharacteristics createMultiInstanceLoopCharacteristics(boolean isSequential, String assigneeListExp, String assignee);

    /**
     * 创建多实例循环解释器
     *
     * @param id
     * @param isSequential 是否 串行
     * @return
     */
    MultiInstanceLoopCharacteristics createMultiInstanceLoopCharacteristics(String id, boolean isSequential);
}
