package com.tsi.api.server.repository;

import com.tsi.api.server.vo.SystemStatusVo;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ConcurrentHashMap;

@Slf4j
public class TsiSystemStatusManager {

    private static TsiSystemStatusManager _instance = null;

    public static TsiSystemStatusManager getInstance() {
        if (_instance == null) {
            synchronized (TsiSystemStatusManager.class) {
                if (_instance == null)
                    _instance = new TsiSystemStatusManager();
            }
        }
        return _instance;
    }

    private ConcurrentHashMap<String, SystemStatusVo> tsiSystemStatusMap;

    private TsiSystemStatusManager() {
        this.tsiSystemStatusMap = new ConcurrentHashMap<>();
    }

    public ConcurrentHashMap<String, SystemStatusVo> getMap() {
        return this.tsiSystemStatusMap;
    }
    public SystemStatusVo get(String key) {
        return this.tsiSystemStatusMap.get(key);
    }
    public void put(String key, SystemStatusVo vo) {
        this.tsiSystemStatusMap.put(key, vo);
    }

    public int size() {
        return this.tsiSystemStatusMap.size();
    }

    public boolean containsKey(String key) {
        return this.tsiSystemStatusMap.containsKey(key);
    }

}
