#pragma once

#include <chrono>

namespace SimCore
{
    template <typename T>
    class Data{

        private:
        
            T data_;

            bool valid_;

            std::uint64_t  writeTime_;

        public:

            Data():valid_(false),writeTime_(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count())
            {

            }

            void setValue(T value)
            {
                data_ = value;
                valid_ = true;
                writeTime_ = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
            }

            T getValue()
            {
                return data_;
            }

            [[deprecated("isValid() instead")]]
            bool getValidity()
            {
                return valid_;
            }

            bool isValid()
            {
                return valid_;
            }

            std::uint64_t getWriteTime()
            {
                return writeTime_;
            }
            
            


    };
} // namespace SimCore
