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

public enum IbmmqEnum {
    SAVE("insert","插入数据"),
    UPDATE("updateById","更新数据"),
	DELETE_BATCH_IDS("deleteBatchIds","删除数据/批量删除");

//    UPDATE_USER("updateUser","更新用户"),
//    DELETE("delete","删除数据"),
//    DELETE_BY_ID("deleteById","删除数据"),
//    DELETE_BY_IDS("deleteByIds","删除数据"),
//
//    DELETE_LOGIC_DELETE("logicDelete","逻辑删除数据"),
//
//    DELETE_LOGIC_DELETE_BUS_ID("logicDeleteByBusId","删除中间表数据"),
//
//
//    DELETE_ENTERPRICE_USER("updateUserByEnterpriceCode","企业用户删除");

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

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

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