package com.bonus.zlpt.company.api.enums;

/**
 * 企业所属枚举类
 */
public enum CompanyLtdEnum {

    /** 广东电网 */
    Guang_Dong(6, "广东电网"),
    /** 广西电网 */
    Guang_Xi(7, "广西电网"),
    /** 贵州电网 */
    Gui_Zhou(8, "贵州电网"),
    /** 云南电网 */
    Yun_Nan(9,"云南电网"),
    /** 海南电网 */
    Hai_Nan(10,"海南电网"),
    /** 储能公司 */
    Chu_NENG(11,"储能公司"),
    /** 深圳供电局 */
    Shen_Zhen(12,"深圳供电局"),
    /** 超高压公司 */
    ChaoGao_Ya(13,"超高压公司");




    private final Integer code;
    private final String name;

    CompanyLtdEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据code获取name
     * @param code
     * @return
     */
    public static String getNameByCode(int code) {
        CompanyLtdEnum[] companyLtdEnums = values();
        for (CompanyLtdEnum companyLtdEnum : companyLtdEnums) {
            if (companyLtdEnum.getCode() == code) {
                return companyLtdEnum.getName();
            }
        }
        return null;
    }

    /**
     *
     * @param msg
     * @return
     */
    public static Integer getCodeByName(String msg) {
        CompanyLtdEnum[] companyLtdEnums = values();
        for (CompanyLtdEnum companyLtdEnum : companyLtdEnums) {
            if (companyLtdEnum.getName() == msg) {
                return companyLtdEnum.getCode();
            }
        }
        return null;
    }


}
