#pragma once

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

#include "blitz/game/Game.h"
#include "blitz/protocol/Protocol.h"

namespace blitz {
namespace protocol {

/**
 * \class ServerConfigPacket
 * \brief Packet for sending the server configuration.
 * %Packet structure :
 * |      PacketType 		 |
 * |-------------------------|
 * | PacketType::ServerConfig|
 *
 * |	 Field Name 	|  	 Field Type		|  			  Notes 			|
 * |--------------------|-------------------|-------------------------------|
 * |	Game Config		|    GameConfig		|    The game configuration		|
 */
class ServerConfigPacket : public Packet {
  private:
	game::GameConfig m_GameConfig;

  public:
	/**
	 * \brief Default constructor.
	 */
	ServerConfigPacket() {}
	/**
	 * \brief Constructor.
	 * \param GameConfig The game configuration.
	 */
	ServerConfigPacket(const game::GameConfig& GameConfig) : m_GameConfig(GameConfig) {}
	virtual ~ServerConfigPacket() {}

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

	/**
	 * \brief Getter of the game configuration
	 * \return The game configuration
	 */
	game::GameConfig GetGameConfig() const {
		return m_GameConfig;
	}

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

}  // namespace protocol
}  // namespace blitz