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

/**
 * 卡扣款类型
 * @author gao
 * @date 2025/11/4 16:29
 */
public enum CardWithdrawTypeEnum {
    GLOBAL_WITHDRAW("1", "速汇扣款"),
    RECHARGE_WITHDRAW("2", "充值扣款"),
    CARD_WITHDRAW("3", "卡扣款");

    private final String code;
    private final String description;

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

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
    public static CardWithdrawTypeEnum fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (CardWithdrawTypeEnum operateType : values()) {
            if (operateType.getCode().equals(code)) {
                return operateType;
            }
        }
        return null;
    }

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

}
