#pragma once

#include "blitz/common/Defines.h"
#include "blitz/network/Connexion.h"

namespace blitz {

class Client;

namespace client {

class ClientConnexion : public network::Connexion {
  private:
	Client* m_Client;
	std::string m_PlayerName;
	game::PlayerID m_PlayerID;

  public:
	ClientConnexion(Client* client);

	virtual void HandlePacket(const protocol::DisconnectPacket* packet) override;
	virtual void HandlePacket(const protocol::KeepAlivePacket* packet) override;
	virtual void HandlePacket(const protocol::ChatPacket* packet) override;
	virtual void HandlePacket(const protocol::ConnexionInfoPacket* packet) override;

	virtual bool Connect(const std::string& pseudo, const std::string& address, std::uint16_t port);

	game::PlayerID GetPlayerID() const {
		return m_PlayerID;
	}

  private:
	void Login(const std::string& pseudo);
	void RegisterHandlers();
};

}  // namespace client
}  // namespace blitz
