package com.m2pool.lease.constant;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

public class DailyBlockOutputConstant {
    // GRS 每日理论出块数常量
    public static final BigDecimal GRS_BLOCK = BigDecimal.valueOf(1440);
    // Mona 每日理论出块数常量
    public static final BigDecimal MONA_BLOCK = BigDecimal.valueOf(960);
    // DGBS 每日理论出块数常量
    public static final BigDecimal DGBS_BLOCK = BigDecimal.valueOf(1180);
    // DGBQ 每日理论出块数常量
    public static final BigDecimal DGBQ_BLOCK = BigDecimal.valueOf(1180);
    // DGBO 每日理论出块数常量
    public static final BigDecimal DGBO_BLOCK = BigDecimal.valueOf(1180);
    // DGB2_ODO 每日理论出块数常量
    public static final BigDecimal DGB2_ODO_BLOCK = BigDecimal.valueOf(720);
    // DGB_QUBIT_A10 每日理论出块数常量
    public static final BigDecimal DGB_QUBIT_A10_BLOCK = BigDecimal.valueOf(720);
    // DGB_SKEIN_A10 每日理论出块数常量
    public static final BigDecimal DGB_SKEIN_A10_BLOCK = BigDecimal.valueOf(720);
    // DGB_ODO_B20 每日理论出块数常量
    public static final BigDecimal DGB_ODO_B20_BLOCK = BigDecimal.valueOf(720);
    // NEXA 每日理论出块数常量
    public static final BigDecimal NEXA_BLOCK = BigDecimal.valueOf(720);
    // RXD 每日理论出块数常量
    public static final BigDecimal RXD_BLOCK = BigDecimal.valueOf(288);
    // ALPH 每日理论出块数常量
    public static final BigDecimal ALPH_BLOCK = BigDecimal.valueOf(5400);
    // ENX 每日理论出块数常量
    public static final BigDecimal ENX_BLOCK = BigDecimal.valueOf(86400);

    private static final Map<String, BigDecimal> BLOCK_MAP;

    static {
        BLOCK_MAP = new HashMap<>();
        BLOCK_MAP.put("grs", GRS_BLOCK);
        BLOCK_MAP.put("mona", MONA_BLOCK);
        BLOCK_MAP.put("dgbs", DGBS_BLOCK);
        BLOCK_MAP.put("dgbq", DGBQ_BLOCK);
        BLOCK_MAP.put("dgbo", DGBO_BLOCK);
        BLOCK_MAP.put("dgb2_odo", DGB2_ODO_BLOCK);
        BLOCK_MAP.put("dgb_qubit_a10", DGB_QUBIT_A10_BLOCK);
        BLOCK_MAP.put("dgb_skein_a10", DGB_SKEIN_A10_BLOCK);
        BLOCK_MAP.put("dgb_odo_b20", DGB_ODO_B20_BLOCK);
        BLOCK_MAP.put("nexa", NEXA_BLOCK);
        BLOCK_MAP.put("rxd", RXD_BLOCK);
        BLOCK_MAP.put("alph", ALPH_BLOCK);
        BLOCK_MAP.put("enx", ENX_BLOCK);
    }

    /**
     * 根据币种名称获取对应的每日理论出块数
     * @param coinName 币种名称，不区分大小写
     * @return 对应的每日理论出块数，如果未找到则返回 null
     */
    public static BigDecimal getBlockCountByCoinName(String coinName) {
        if (coinName == null) {
            return BigDecimal.ZERO;
        }
        return BLOCK_MAP.get(coinName.toLowerCase());
    }
}
