package com.ruoyi.ibs.enumertion;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum CustIdTypeEnum {
    USCI("营业执照", "202"),

    ID_CARD("居民二代身份证", "101");

    private String name;
    private String code;

    @JsonValue
    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }


    public static CustIdTypeEnum getByCode(String code) {
        if (code == null) {
            return null;
        }
        for (CustIdTypeEnum type : CustIdTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

    public static CustIdTypeEnum getByName(String name) {
        if (name == null) {
            return null;
        }
        for (CustIdTypeEnum type : CustIdTypeEnum.values()) {
            if (type.getName().equals(name)) {
                return type;
            }
        }
        return null;
    }

}
