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

public enum PushDataStatusEnum {

    PUSH_STATUS_SUCCESS("1","推送成功"),
    PUSH_STATUS_ERROR("2","推送失败");

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

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

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