package com.jxy.marketall.enums;

/**
 * @Description 订阅指标枚举类
 * @Date 2022/6/10 10:13
 * @Author 杜懿
 */
public enum SubscriptionType {

    BTC_VOLUME_REALTIME("ls-1-1", "BTCOnChain","volume","rt_dailyindsv2e1","realTime"),
    BTC_FEES_REALTIME("ls-1-2", "BTCOnChain","fees","rt_dailyindsv2e1","realTime"),
    BTC_EAVOLUME_REALTIME("ls-1-3", "BTCOnChain","eavolume","rt_dailyindsv2e1","realTime"),
    BTC_ACTIVE_ADDRESS_REALTIME("ls-2-1", "BTCOnChain","active_address","rt_dailyindsv2e1","realTime"),
    BTC_SEND_ADDRESS_REALTIME("ls-2-2", "BTCOnChain","send_address","rt_dailyindsv2e1","realTime"),
    BTC_RECEIVE_ADDRESS_REALTIME("ls-2-3", "BTCOnChain","receive_address","rt_dailyindsv2e1","realTime"),
    //巨鲸地址 mongodb.topList
    BTC_GIANTWHALE_ADDRESS_REALTIME("ls-2-4", "BTCOnChain","giant_whale_address","toplist","realTime"),
    BTC_ASOL_REALTIME("ls-3-1", "BTCOnChain","asol","rt_dailyindsv2e1","realTime"),
    BTC_CDD_REALTIME("ls-3-2", "BTCOnChain","cdd","rt_dailyindsv2e1","realTime");

    private final String id;
    private final String channel;
    private final String metrics;
    private final String table;
    private final String interval;

    SubscriptionType(String id, String channel,String metrics,String table, String interval)
    {
        this.id = id;
        this.channel = channel;
        this.metrics = metrics;
        this.table = table;
        this.interval = interval;
    }

    public String getId()
    {
        return id;
    }

    public String getChannel()
    {
        return channel;
    }

    public String getMetrics()
    {
        return metrics;
    }

    public String getTable()
    {
        return table;
    }

    public String getInterval()
    {
        return interval;
    }

    public static SubscriptionType getStatusById(String id){
        for (SubscriptionType s : SubscriptionType.values()) {
            if(s.getId().equals(id)){
                return s;
            }
        }
        return null;
    }

    public static String getMetricsById(String id){
        for (SubscriptionType s : SubscriptionType.values()) {
            if(s.getId().equals(id)){
                return s.getMetrics();
            }
        }
        return null;
    }

}
