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

/**
 * 卡3ds类型
 * @author gao
 * @date 2025/11/4 16:29
 */
public enum Card3dsTransactionTypeEnum {
    THIRD_3DS_OTP("third_3ds_otp", "3ds验证码"),
    AUTH_URL("auth_url", "交易授权响应url"),
    ACTIVATION_CODE("activation_code", "激活码");

    private final String code;
    private final String description;

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

    public String getCode() {
        return code;
    }

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

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

}
