package com.sencorsta.rabs.config;

import cn.hutool.setting.Setting;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.Getter;
import lombok.Setter;

import java.util.Map;

/**
 * @author daibin
 */
public class AppConfig {
    private static AppConfig instance;
    @Getter
    @Setter
    private Setting setting;
    @Getter
    @Setter
    private Map<Integer, JsonNode> fishMap;

    private AppConfig() {
        this.setting = ConfigReader.readConfig();
    }

    public static synchronized AppConfig getInstance() {
        if (instance == null) {
            instance = new AppConfig();
        }
        return instance;
    }

    public String getFont() {
        return setting.getStr("appFont", "Microsoft YaHei UI");
    }

    public int getFontSize() {
        return setting.getInt("appFontSize", 12);
    }

    public void saveAll() {
        setting.store();
    }

}
