package cn.palmte.work.config.activiti;


import cn.palmte.work.exception.ResponseException;
import lombok.Getter;

/**
 * 流程审批类型枚举
 */
@Getter
public enum ActApproveTypeEnum {
    APPROVAL_PASSED(2, "审核通过"),
    APPROVAL_UN_PASS(3, "审核不通过");


    private int type;
    private String name;

    ActApproveTypeEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    public static ActApproveTypeEnum ofType(int type) {
        if (type == APPROVAL_PASSED.getType()) {
            return APPROVAL_PASSED;
        } else if (type == APPROVAL_UN_PASS.getType()) {
            return APPROVAL_UN_PASS;
        } else {
            throw new ResponseException("不支持的审批类型【" + type + "】");
        }
    }
}
