package com.ningdatech.pmapi.projectlib.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 *
 * 实例类型枚举
 * @author CMM
 * @since 2023/02/24 16:14
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum InstTypeEnum {
    /**
     * 流程实例类型
     */
    UNIT_INNER_AUDIT(1, "单位内部审批流程"),
    PRELIMINARY_PREVIEW(2, "项目预审审批流程"),
    DEPT_UNITED_REVIEW(3,"部门联合审批流程"),
    CONSTRUCTION_PLAN_REVIEW(4,"建设方案审批流程"),
    PROJECT_FINAL_INSPECTION(5,"验收申报审批流程");

    private Integer code;
    private String desc;

    public static String getDescByCode(Integer code) {
        if (Objects.isNull(code)) {
            return StringUtils.EMPTY;
        }
        for (InstTypeEnum t : InstTypeEnum.values()) {
            if (code.equals(t.getCode())) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }
}
