#ifndef TIMER_HPP_INCLUDED
#define TIMER_HPP_INCLUDED

#include <iostream>
#include <cstdint>

/** @addtogroup Types
* @{ */
class Timer
{
    public:

        /**
		* @brief Constructs a Timer, and optionally starts it
		* @param bool Start
		* @par Description
		* Constructs a Timer, and starts it
		*/
        Timer(bool Start = true);

        /**
		* @brief Restarts the Timer
		* @par Detailed Description
		* Sets the Timer start time to the current time
		*/
        void Restart();

        /**
		* @brief Increases the Timer's elapsed time by MS
		* @return Returns the Time's elapsed time by MS
		* @par Description
		* Increases the Timer's elapsed time by MS
		*/
        std::int64_t FastForward(std::uint32_t Duration);

        /**
		* @brief Decreases the Timer's elapsed time by MS
		* @return Returns the Time's elapsed time by MS
		* @par Description
		* Decreases the Timer's elapsed time by MS
		*/
        std::int64_t Rewind(std::uint32_t Duration);

        /**
		* @brief Pauses the Timer
		* @return Returns the Time's elapsed time by MS
		* @par Description
		* Pauses the Timer
		*/
        std::int64_t Suspend();

        /**
		* @brief Resumes the Timer
		* @return Returns the Timer's elapsed time by MS
		* @par Description
		* Resumes the Timer
		*/
        std::int64_t Resume();

        /**
		* @brief Returns when the Timer started, in MS
		* @return When the Timer started, in MS
		*/
        std::uint64_t GetStartTime() const;

        /**
		* @brief Returns the Timer's elapsed Time, in MS
		* @return The Timer's elapsed Time, in MS
		*/
        std::int64_t GetTimeElapsed() const;

        /**
		* @brief Returns True if the Timer is currently Paused
		* @return True if the Timer is currently Paused
		*/
        bool Paused() const;

        friend std::ostream& operator<<(std::ostream& OS, const Timer& T);
        ~Timer();
    private:
        std::uint64_t StartTime;
        std::uint64_t PauseTime;
        std::int64_t Offset;
};

/** @} */

#endif // TIMER_HPP_INCLUDED
