package com.jxy.marketall.enums;

import com.jxy.common.core.utils.StringUtils;

public enum ExchangeRateSumbolCNName {

    USD_JPY("USDJPY", "美元/日元"),
    USD_EUR("USDEUR", "美元/欧元"),
    USD_GBP("USDGBP", "美元/英镑"),
    USD_CHF("USDCHF", "美元/瑞士法郎"),
    USD_SEK("USDSEK", "美元/瑞典克朗"),
    USD_CAD("USDCAD", "美元/加元"),
    USD_CNY("USDCNY", "美元/人民币"),
    USD_RUB("USDRUB", "美元/卢布"),
    DXY("DXY", "美元指数");

    private final String symbol;
    private final String cn;

    ExchangeRateSumbolCNName(String symbol, String cn) {
        this.symbol = symbol;
        this.cn = cn;
    }

    public String getSymbol() {
        return symbol;
    }

    public String getCn() {
        return cn;
    }

    public static String getCNBySymbol(String symbol){
        if(StringUtils.isBlank(symbol)){
            return "";
        }
        for (ExchangeRateSumbolCNName e : ExchangeRateSumbolCNName.values()) {
            if(e.getSymbol().toUpperCase().equals(symbol.toUpperCase())){
                return e.getCn();
            }
        }
        return "";
    }
}
