package com.bonus.sgzb.common.core.enums;

/**
 * @description: 报废来源
 */
public enum ScrapSourceEnum {

    MATERIAL_RETURN(1, "退料"),
    MAINTENANCE_COST(2, "维修"),
    MAKE_AN_INVENTORY(3, "盘点"),
    ;

    private final Integer code;
    private final String info;

    ScrapSourceEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public Integer getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public static Integer getCodeByInfo(String info) {
        for (ScrapSourceEnum value : ScrapSourceEnum.values()) {
            if (value.getInfo().equals(info)) {
                return value.getCode();
            }
        }
        return null;
    }

    public static String getInfoByCode(Integer code) {
        for (ScrapSourceEnum value : ScrapSourceEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getInfo();
            }
        }
        return null;
    }
}
