package com.its.pis.global;

import com.its.pis.entity.TbPisInfr;
import com.its.pis.entity.TbPrkPlce;
import io.netty.channel.Channel;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ConcurrentHashMap;

@Slf4j
@Getter
@Setter
public class AppRepository {
    private static AppRepository _instance = null;

    public ConcurrentHashMap<String, TbPisInfr> pisInfrMap = null;
    public ConcurrentHashMap<String, TbPisInfr> pisIpAddrMap = null;
    public ConcurrentHashMap<String, TbPisInfr> pisTokenMap = null;
    public ConcurrentHashMap<String, TbPisInfr> pisIdMap = null;

    public ConcurrentHashMap<String, TbPrkPlce> prltNmbrMap = null;
    public ConcurrentHashMap<String, TbPrkPlce> prltIdMap = null;

    public ConcurrentHashMap<Channel, TbPisInfr> ctlrChannelMap = null;

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

    public AppRepository() {
        this.pisInfrMap = new ConcurrentHashMap<>();
        this.pisTokenMap = new ConcurrentHashMap<>();
        this.pisIpAddrMap = new ConcurrentHashMap<>();
        this.pisIdMap = new ConcurrentHashMap<>();

        this.prltNmbrMap = new ConcurrentHashMap<>();
        this.prltIdMap = new ConcurrentHashMap<>();

        this.ctlrChannelMap = new ConcurrentHashMap<>();
     }

}
