package cn.stylefeng.workflow.instance.api.exceptions;

import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
import lombok.Getter;

@Getter
public enum InstanceExceptionEnum implements AbstractExceptionEnum {

    DEFINITION_ID_IS_NULL(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10001", "流程定义为空"),

    START_TYPE_IS_NULL(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10002", "发起类型为空，无法发起流程"),

    VAR_IS_NULL(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10003", "流程变量存在空值，无法进行流程，流程变量名称为：{}"),

    INSTANCE_ID_IS_NULL(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10004", "流程实例为空，无法完成操作"),

    RU_NODE_ID_IS_NULL(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10005", "运行时节点为空，无法完成操作"),

    INSTANCE_STATUS_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10006", "流程状态错误，无法完成操作，当前流程状态为：{}"),

    SUSPEND_ERROR_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10008", "流程无法挂起，流程状态错误，当前流程状态为：{}"),

    ACTIVE_ERROR_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10009", "流程无法激活，流程状态错误，当前流程状态为：{}"),

    INVALID_ERROR_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10010", "已完成的流程无法作废"),

    FINISH_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10011", "已完成的流程无法改为拒绝状态"),

    RUNTIME_NODE_COUNT_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10012", "流程实例存在节点的多个运行时节点");

    private final String errorCode;

    private final String userTip;

    InstanceExceptionEnum(String errorCode, String userTip) {
        this.errorCode = errorCode;
        this.userTip = userTip;
    }

}