#ifndef REGISTERING_DISPLAY_HPP_
#define REGISTERING_DISPLAY_HPP_

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

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

    void finish(Material &icon, const std::string &caption, const std::string &msg);

public:
    /**
     * @brief Construct a new registering display.
     * 
     * This display will try to register on the specified server asynchronously. It will then show a
     * `MessageDisplay` with the result of this operation.
     * 
     * @param userName The desired user name.
     * @param password The desired password.
     * @param server The server.
     */
    RegisteringDisplay(std::string userName, std::string password, std::string server);

    virtual void update() override;
};

#endif