package org.jeecg.modules.baogao.common;

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

import java.util.Arrays;

@Getter
public enum BGType {
    /**
     *
     */
    Mo1("0", "检验检测机构资质认定CMA（海检检测）"),
    /**
     *
     */
    Mo2("1", "实验室认可标识CNAS"),
    /**
     *
     */
    Mo3("2", "其他Others"),


    ;

    BGType(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(BGType.values()).filter(i -> code.equals(i.getCode())).map(i -> i.getName()).findFirst().orElse(null);
    }

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

}
