#ifndef PINGER_HPP_
#define PINGER_HPP_

#include <Version/Version.hpp>
#include <string>
#include <memory>
#include <atomic>
#include <Utilities/Extern.hpp>

class Pinger final
{
private:
    struct PingState
    {
        std::atomic<bool> ready;
        std::string error;
        std::string motto;
        std::string resolvedAddr = "IP not resolved.";
        Version serverVersion;
        Uint32 timeMS;
    };

    std::shared_ptr<PingState> state;
    std::string addr;

public:
    enum class State
    {
        Pinging,
        Error,
        Success,
    };

    Pinger(std::string addr);

    State getState();
    const std::string& getError();
    const std::string& getMotto();
    Uint32 getTimeMS();
    Version getServerVersion();
    const std::string& getAddr();
    const std::string& getResolvedAddr();
};

#endif