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

/**
 * 速汇转账类型
 * @author gao
 * @date 2025/11/12 17:13
 */
public enum GlobalTransferTypeEnum {
    B2B("1", "C2B"),
    B2C("2", "B2C"),
    C2C("3", "C2C"),
    C2B("4", "C2B");

    private final String key;
    private final String value;

    GlobalTransferTypeEnum(String status, String value) {
        this.key = status;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static GlobalTransferTypeEnum fromType(String key) {
        if (key == null) {
            return null;
        }
        for (GlobalTransferTypeEnum typeEnum : values()) {
            if (typeEnum.getKey().equals(key)) {
                return typeEnum;
            }
        }
        return null;
    }

    public static String matchType(String key) {
        GlobalTransferTypeEnum typeEnum = fromType(key);
        return typeEnum != null ? typeEnum.getValue() : "";
    }

}
