#pragma once

#include "GuiWidget.h"

#include "imgui/imgui_filebrowser.h"

#include "server/Server.h"

#include <memory>

namespace td {
namespace gui {

class ServerGui;

class MainMenu : public GuiWidget {
private:
	bool m_TriedToConnect = false;
	bool m_TriedToCreate = false;
	std::string m_ConnectAddress;
	int m_ConnectPort;
	int m_ServerPort = 25565;
	std::string m_WorldFilePath;
	imgui_addons::ImGuiFileBrowser m_FileDialog;

	std::unique_ptr<server::Server> m_Server;
	std::unique_ptr<ServerGui> m_ServerGui;
public:
	MainMenu(client::Client* client);
	~MainMenu();

	virtual void Render();

	const server::Server* GetServer() const { return m_Server.get(); }
private:
	bool StartServer();
};

} // namespace gui
} // namespace td
