#pragma once

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

#include "blitz/common/Defines.h"
#include "blitz/game/Player.h"
#include "blitz/protocol/Protocol.h"

namespace blitz {
namespace protocol {

/**
 * \class PlayerStatsPacket
 * \brief Packet for sending player stats.
 * %Packet structure :
 * |      PacketType 		|
 * |------------------------|
 * | PacketType::PlayerStats|
 *
 * |	 Field Name 	|  	 Field Type		|  			  Notes 			|
 * |--------------------|-------------------|-------------------------------|
 * |	Player ID		|  	  PlayerID	    |  		Id of the player		|
 * |	Player Stats	|    PlayerStats    | 		Stats of the player		|
 */
class PlayerStatsPacket : public Packet {
  private:
	game::PlayerID m_PlayerID;
	game::PlayerStats m_PlayerStats;

  public:
	/**
	 * \brief Default constructor.
	 */
	PlayerStatsPacket() {}
	/**
	 * \brief Constructor.
	 * \param playerID The ID of the player.
	 * \param stats The stats of the player.
	 */
	PlayerStatsPacket(game::PlayerID playerID, const game::PlayerStats& stats) : m_PlayerID(playerID), m_PlayerStats(stats) {}
	virtual ~PlayerStatsPacket() {}

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

	/**
	 * \brief Getter of the player id
	 * \return The ID of the player
	 */
	game::PlayerID GetPlayerID() const {
		return m_PlayerID;
	}

	/**
	 * \brief Getter of the player stats
	 * \return The stats of the player
	 */
	const game::PlayerStats& GetPlayerStats() const {
		return m_PlayerStats;
	}

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

}  // namespace protocol
}  // namespace blitz
