package org.qinan.safetyeval.domain.constant;

/**
 * 专业能力
 */
public enum ProfessionalCapabilityEnum {

    MINING(1, "采矿"),
    SAFETY(2, "安全"),
    MACHINERY(3, "机械"),
    VENTILATION(4, "通风"),
    GEOLOGY(5, "地质"),
    HYDRAULIC_STRUCTURE(6, "水工结构"),
    ELECTRICAL(7, "电气"),
    MECHANICAL_ENGINEERING(8, "机械工程");

    private final int code;
    private final String name;

    ProfessionalCapabilityEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ProfessionalCapabilityEnum ofCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ProfessionalCapabilityEnum item : values()) {
            if (item.code == code) {
                return item;
            }
        }
        return null;
    }
}
