#ifndef CONNECTING_DISPLAY_HPP_
#define CONNECTING_DISPLAY_HPP_

#include <Display/WidgetDisplay/WidgetDisplay.hpp>
#include <Authenticator/Authenticator.hpp>
#include <CommandQueue/CommandQueue.hpp>

/**
 * @brief The display showing the "Connecting..." message, and redirecting to game or error.
 */
class ConnectingDisplay : public WidgetDisplay
{
private:
    CommandQueue<ConnectingDisplay> m_cmdqueue;

    void error(const std::string &caption, const std::string &msg);

public:
    /**
     * @brief Construct a new connecting display.
     * 
     * This display will try to log in to the specified server asynchronously. If the connection
     * was successful, it will switch to a `WorldDisplay` with a `RemoteWorld`.
     * 
     * @param auth The authenticator.
     * @param server The server.
     */
    ConnectingDisplay(std::shared_ptr<Authenticator> auth, std::string server);

    virtual void update() override;
};

#endif