#pragma once




#include "nlohmann/json_fwd.hpp"
#include <SimCore/Identifier.hpp>
#include <SimControl/TrackItem.hpp>
#include <cstddef>
#include <nlohmann/json.hpp>
#include <map>
#include <memory>
#include <mutex>
#include <vector>



namespace SimControl
{
    

   

    class TrackList
    {
        public: 
            TrackList();
            void addTrack(std::shared_ptr<SimControl::TrackItem> Track);
            std::shared_ptr<SimControl::TrackItem> getTrack(SimCore::Identifier);
            
            void deleteTrack(std::string ID);
            void deleteTrack(SimCore::Identifier);
            std::shared_ptr<SimCore::SimTrack> getTrackBySringID(std::string ID);


            void getJsonTRackList(nlohmann::json &message);
            size_t getTracklistSize();
            

        private: 
            mutable std::mutex mx_;
            std::map<std::string, std::shared_ptr<SimControl::TrackItem>> TrackStore_;

            // std::map<std::string, std::time_t> markedAsDeletedTracks_;

            void checkTracksTimeout();

            const int TrackTimeoutTime = 6;


    };
}