#pragma once

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

#include "blitz/protocol/Protocol.h"

namespace blitz {
namespace protocol {

/**
 * \class ConnexionInfoPacket
 * \brief Packet for sending connection information.
 * %Packet structure :
 * |      PacketType 		|
 * |------------------------|
 * | PacketType::ConnexionInfo	|
 *
 * |	 Field Name 	|  	 Field Type		|  			  Notes 			|
 * |--------------------|-------------------|-------------------------------|
 * |	m_ConnectionID	|    std::uint8_t  	|     The connection ID			|
 */
class ConnexionInfoPacket : public Packet {
  private:
	std::uint8_t m_ConnectionID;

  public:
	/**
	 * \brief Default constructor.
	 */
	ConnexionInfoPacket() {}
	/**
	 * \brief Constructor.
	 * \param connectionID The ID of the connection.
	 */
	ConnexionInfoPacket(std::uint8_t connectionID) : m_ConnectionID(connectionID) {}
	virtual ~ConnexionInfoPacket() {}

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

	/**
	 * \brief Get the connection ID.
	 * \return The connection ID.
	 */
	std::uint8_t GetConnectionID() const {
		return m_ConnectionID;
	}

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

}  // namespace protocol
}  // namespace blitz
