#pragma once

#include "GuiWidget.h"

#include <future>
#include <memory>

namespace td {

namespace utils {

class Updater;

} // namespace utils

namespace gui {

class UpdateMenu : public GuiWidget {
private:
	bool m_Opened;
	std::string m_Error;
	std::unique_ptr<utils::Updater> m_Updater;
	std::shared_future<bool> m_UpdateAvailable;
public:
	UpdateMenu(client::Client* client);
	virtual ~UpdateMenu();

	virtual void Render();
private:
	void CheckUpdates();
	bool IsUpdateChecked();
	void RenderErrorPopup();
};

} // namespace gui
} // namespace td
