package com.m2pool.lease.redis;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description redis key
 * @Date 2025/8/18 09:49
 * @Author yyb
 */
public class RedisCoinInfoKey {
    // 静态不可变的 Map，存储币种名和对应价格标识
    private static final Map<String, String> COIN_PRICE_MAP;

    private static final Map<String, String> COIN_MHS_MAP;

    private static final Map<String, String> COIN_REWARD_MAP;
    static {

        Map<String, String> mapPrice = new HashMap<>();
        mapPrice.put("nexa", "nexa:price");
        mapPrice.put("mona", "mona:price");
        mapPrice.put("rxd", "rxd:price");
        mapPrice.put("grs", "grs:price");
        mapPrice.put("dgbs","dgb:price");
        mapPrice.put("dgbq","dgb:price");
        mapPrice.put("dgbo","dgb:price");
        mapPrice.put("alph","alph:price");
        mapPrice.put("eth","eth:price");

        Map<String, String> mapMhs = new HashMap<>();
        mapMhs.put("nexa", "nexa:mhs");
        mapMhs.put("mona", "mona:mhs");
        mapMhs.put("rxd", "rxd:mhs");
        mapMhs.put("grs", "grs:mhs");
        mapMhs.put("dgbo","dgbo:mhs");
        mapMhs.put("dgbq","dgbq:mhs");
        mapMhs.put("dgbs","dgbs:mhs");
        mapMhs.put("alph","alph:mhs");


        Map<String, String> mapReward = new HashMap<>();
        mapReward.put("nexa", "nexa:reward");
        mapReward.put("mona", "mona:reward");
        mapReward.put("rxd", "rxd:reward");
        mapReward.put("grs", "grs:reward");
        mapReward.put("dgbs","dgb:reward");
        mapReward.put("dgbq","dgb:reward");
        mapReward.put("dgbo","dgb:reward");
        mapReward.put("alph","alph:reward");
        COIN_PRICE_MAP = Collections.unmodifiableMap(mapPrice);
        COIN_MHS_MAP = Collections.unmodifiableMap(mapMhs);
        COIN_REWARD_MAP = Collections.unmodifiableMap(mapReward);
    }

    /**
     * 根据币种名获取对应的价格标识
     * @param coinName 币种名
     * @return 对应的价格标识，若不存在则返回 null
     */
    public static String getPiceKey(String coinName) {
        return COIN_PRICE_MAP.get(coinName);
    }

    public static String getMhsKey(String coinName) {
        return COIN_MHS_MAP.get(coinName);
    }
    public static String getRewardKey(String coinName) {
        return COIN_REWARD_MAP.get(coinName);
    }
}
