#pragma once

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

#include "blitz/protocol/Protocol.h"

namespace blitz {
namespace protocol {

/**
 * \class UpdateHealthPacket
 * \brief Packet for updating the health of a player.
 * %Packet structure :
 * |      PacketType 		  |
 * |--------------------------|
 * | PacketType::UpdateHealth |
 *
 * |	 Field Name 	|  	 Field Type		|  			  Notes 			|
 * |--------------------|-------------------|-------------------------------|
 * |	m_NewHealth		|     float			|	The new health value		|
 */
class UpdateHealthPacket : public Packet {
  private:
	float m_NewHealth;

  public:
	/**
	 * \brief Default constructor.
	 */
	UpdateHealthPacket() {}
	/**
	 * \brief Constructor.
	 * \param newHealth The new health value.
	 */
	UpdateHealthPacket(float newHealth) : m_NewHealth(newHealth) {}
	virtual ~UpdateHealthPacket() {}

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

	/**
	 * \brief Get the new health value.
	 * \return The new health value.
	 */
	float GetNewHealth() const {
		return m_NewHealth;
	}

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

}  // namespace protocol
}  // namespace blitz