package cn.palmte.work.config.activiti;


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

/**
 * 流程里的项目类型枚举
 */
@Getter
public enum ActProjectTypeEnum {
    FOURCAL(0, "四算项目"),
    SALE_CONTRACT(1, "销售合同项目"),
    BUSINESS_PURCHASE(2, "业务采购项目");


    private int type;
    private String name;

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

    public static ActProjectTypeEnum ofType(int type) {
        if (type == FOURCAL.getType()) {
            return FOURCAL;
        } else if (type == SALE_CONTRACT.getType()) {
            return SALE_CONTRACT;
        } else if (type == BUSINESS_PURCHASE.getType()) {
            return BUSINESS_PURCHASE;
        } else {
            throw new ResponseException("不支持的项目类型【" + type + "】");
        }
    }
}
