#pragma once

#include <godot_cpp/classes/node.hpp>
#include "NetworkInterface.h"

namespace blitz {

class Lobby : public godot::Node {
	GDCLASS(Lobby, godot::Node)
  protected:
	static void _bind_methods();

  public:
	Lobby();
	~Lobby();

	void _ready() override;

	godot::Error JoinGame(const godot::String& a_Address, uint16_t a_Port);
	godot::Error CreateGame(uint16_t a_Port, bool a_Dedicated = false);

	void Shutdown();

  private:
	void OnPlayerConnected(PeerID a_PeerId);
	void OnPlayerDisconnected(PeerID a_PeerId);
	void OnConnectOk();
	void OnConnectFail();
	void OnServerDisconnected();
};

}  // namespace blitz