package cn.gov.customs.wxjy.ibmmq.enums;

public enum PushDataTypeEnum {
    PUSH_DATA_INFO("1","推送数据"),
    PUSH_DATA_FILE("2","推送文件");

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

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

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