package com.crm.rely.backend.core.enums;

/**
 * 充值类型枚举
 * @author gao
 * @date 2025/11/4 16:29
 */
public enum CardRechargeTypeEnum {
    RECHARGE_DEFAULT_AMOUNT("1","充值默认金额"),
    GLOBAL_REFUND("2", "速汇订单退款"),
    RECHARGE("3", "充值");

    private final String code;
    private final String description;

    CardRechargeTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }


    public static CardRechargeTypeEnum fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (CardRechargeTypeEnum statusType : values()) {
            if (statusType.getCode().equals(code)) {
                return statusType;
            }
        }
        return null;
    }

    public static String matchCode(String code) {
        CardRechargeTypeEnum statusTypeEnum = fromCode(code);
        return statusTypeEnum != null ? statusTypeEnum.getDescription() : "";
    }
}
