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

public enum ScrapTypeEnum {

    NATURAL("0", "自然"),
    ARTIFICIAL("1", "人为");

    private final String code;
    private final String info;

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

    public String getCode()
    {
        return code;
    }

    public String getInfo()
    {
        return info;
    }


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

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

}
