package org.jeecg.modules.baogao.common;

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

import java.util.Arrays;

@Getter
public enum BGXsType {
    zy("0", "中英文"),
    z("1", "中文"),
    y("2", "英文"),



    no("3", "不需要"),

    ;

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

    private  String code;
    private  String name;
    public static final String  getCode(String code) {
        if (StringUtils.isEmpty(code)) {
            return null;
        }
        return Arrays.stream(BGXsType.values()).filter(i -> code.equals(i.getCode())).map(i -> i.getName()).findFirst().orElse(null);
    }

    public static final BGXsType get(String code) {
        if (StringUtils.isEmpty(code)) {
            return null;
        }
        return Arrays.stream(BGXsType.values()).filter(i -> code.equals(i.getCode())).findFirst().orElse(null);
    }
}
