#pragma once

#include "td/protocol/Protocol.h"

namespace td {
namespace protocol {

class PlayerJoinPacket : public Packet {
private:
	std::uint8_t m_PlayerID;
	std::string m_PlayerName;
public:
	PlayerJoinPacket() {}
	PlayerJoinPacket(std::uint8_t playerID, const std::string& playerName) : m_PlayerID(playerID), m_PlayerName(playerName) {}
	virtual ~PlayerJoinPacket() {}

	virtual DataBuffer Serialize(bool packetID = true) const;
	virtual void Deserialize(DataBuffer& data);
	virtual void Dispatch(PacketHandler* handler) const;

	std::uint8_t GetPlayerID() const { return m_PlayerID; }
	const std::string& GetPlayerName() const { return m_PlayerName; }

	virtual PacketType GetType() const { return PacketType::PlayerJoin; }
};

} // namespace protocol
} // namespace td
