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

/**
 * 速汇转账方式
 *
 * @author gao
 * @date 2025/11/12 17:13
 */
public enum GlobalPayoutMethodEnum {
    BANK_TRANSFER("1", "Bank Transfer", "银行转账"),
    BANK_TRANSFER_GLOBAL_USD("7", "Bank Transfer Global USD", "银行转账全球USD");

    private final String key;
    private final String value;
    private final String remark;

    GlobalPayoutMethodEnum(String key, String value, String remark) {
        this.key = key;
        this.value = value;
        this.remark = remark;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public String getRemark() {
        return remark;
    }

    public static GlobalPayoutMethodEnum fromKey(String key) {
        if (key == null) {
            return null;
        }
        for (GlobalPayoutMethodEnum statusEnum : values()) {
            if (statusEnum.getKey().equals(key)) {
                return statusEnum;
            }
        }
        return null;
    }


    public static String matchValue(String value) {
        if (value == null) {
            return "";
        }
        for (GlobalPayoutMethodEnum statusEnum : values()) {
            if (statusEnum.getValue().equals(value)) {
                return statusEnum.getRemark();
            }
        }
        return "";
    }

    public static String matchKey(String key) {
        if (key == null) {
            return "";
        }
        for (GlobalPayoutMethodEnum statusEnum : values()) {
            if (statusEnum.getKey().equals(key)) {
                return statusEnum.getValue();
            }
        }
        return "";
    }

    public static String matchRemark(String key) {
        GlobalPayoutMethodEnum statusEnum = fromKey(key);
        return statusEnum != null ? statusEnum.getRemark() : "";
    }

    public static String matchCountry(String key, String country) {
        GlobalPayoutMethodEnum statusEnum = fromKey(key);
        if ("CN".equals(country)) {
            return statusEnum != null ? statusEnum.getRemark() : "";
        }
        return statusEnum != null ? statusEnum.getValue() : "";
    }


}
