package net.northking.cctp.flowable.common.exception;

import net.northking.cctp.common.exception.PlatformError;

public enum FlowAppError implements PlatformError {

    FIRST(230000, "First"),


    CATA_CODE_IS_EMPTY("字典代码为空"),
    ANY_TO_ANY_ROLE_IS_EMPTY("所有到所有权限缺少角色"),
    FLOW_NAME_IS_DULICATED("流程名称已存在，请修改"),
    FLOW_IS_DEFAULTED_NOT_ALLOWED_DELETED("被删流程为默认流程，不可删除"),
    SAVE_FAILED("缺陷流程保存失败"),
    DELETE_FAILED("流程删除失败：所选流程不存在"),
    FLOW_IS_NOT_EXIST("所选流程不存在"),
    DUPLICATED_STATE("状态【{0}】存在重复，请修改"),
    EVENTS_IS_EMPTY("缺少所需流向的节点，请修改"),
    EMPTY_INITIAL_STATE("不存在开始节点"),
    EMPTY_FINISHED_STATE("没有结束节点，请修改"),
    INITIAL_STATE_ERROR_EVENT("开始节点【{0}】连线有误，至少存在一条出路"),
    FINISHED_STATE_ERROR_EVENT("结束节点【{0}】的连线有误，至少存在一条进路"),
    NORMAL_STATE_ERROR_EVENT("节点【{0}】的连线有误，进路与出路必须都存在"),
    //日志
    NOTICE_INSERT("创建日志通知失败"),
    SET_DEFAULTED_IS_FAILED("设置默认流程失败"),


    // 实施流程
    DUPLICATED_NODE("节点【{0}】存在重复，请修改"),
    NODE_NAME_IS_EMPTY("流程节点名称没有选择"),
    NODE_LINE_IS_NECESSARY("节点【{0}】需要连线"),
    STATE_NODE_IS_EMPTY("实施流程不能没有流程节点"),

    LAST(239999, "Last");
    private static final int START_CODE = 230000;

    private final Integer code;
    private final String msg;

    FlowAppError(Integer code, String msg)
    {
        this.code = code;
        this.msg = msg;
    }

    FlowAppError(String msg)
    {
        this.code = ordinal() + START_CODE;
        this.msg = msg;
    }
    @Override
    public Integer getCode()
    {
        return code;
    }

    @Override
    public String getMsg()
    {
        return msg;
    }
}
