package cn.gov.customs.wxjy.constants;

public enum IsDeleteOrStatusEnum {
    DEFAULT_STATUS("0","正常"),
    DELETE_STATUS("1","删除");

    private final String code;
    private final String name;
    IsDeleteOrStatusEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }
    public String getCode() {
        return code;
    }
    public String getName() {
        return name;
    }

    // 根据 code 获取对应的枚举实例
    public static IsDeleteOrStatusEnum fromCode(String code) {
        for (IsDeleteOrStatusEnum status : IsDeleteOrStatusEnum.values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的状态码: " + code);
    }

    // 根据 code 获取对应的 name
    public static String getNameByCode(String code) {
        IsDeleteOrStatusEnum status = fromCode(code);
        return status.getName();
    }
}
