#pragma once

/**
 * \file PlayerListPacket.h
 * \brief File containing the blitz::protocol::PlayerListPacket class
 */

#include <map>

#include "blitz/protocol/Protocol.h"

namespace blitz {
namespace protocol {

/**
 * \struct PlayerInfo
 * \brief Represents information about a player.
 */
struct PlayerInfo {
	std::string name;
};

typedef std::map<std::uint8_t, PlayerInfo> PlayerList;

/**
 * \class PlayerListPacket
 * \brief Packet for sending the list of players.
 * \todo PACKET STRUCTURE
 */
class PlayerListPacket : public Packet {
  private:
	PlayerList m_Players;

  public:
	/**
	 * \brief Default constructor.
	 */
	PlayerListPacket() {}
	/**
	 * \brief Constructor.
	 * \param players The list of players.
	 */
	PlayerListPacket(const PlayerList& players) : m_Players(players) {}
	virtual ~PlayerListPacket() {}

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


	/**
	 * \brief Get the list of players.
	 * \return The list of players.
	 */
	const PlayerList& GetPlayers() const {
		return m_Players;
	}

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

}  // namespace protocol
}  // namespace blitz
