#pragma once

#include "blitz/Vector.h"
#include "blitz/Defines.h"
#include "blitz/protocol/Protocol.h"

namespace blitz {
namespace protocol {

class PlayerPositionAndRotationPacket : public Packet {
  private:
	game::PlayerID m_Player;  // only used when sent to client
	Vec3f m_Position;
	float m_Yaw, m_Pitch;

  public:
	PlayerPositionAndRotationPacket() {}
	PlayerPositionAndRotationPacket(const Vec3f& position, float yaw, float pitch, game::PlayerID player = 0) :
		m_Player(player), m_Position(position), m_Yaw(yaw), m_Pitch(pitch) {}

	virtual ~PlayerPositionAndRotationPacket() {}

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

	const Vec3f& GetPosition() const {
		return m_Position;
	}

	float GetYaw() const {
		return m_Yaw;
	}

	float GetPitch() const {
		return m_Pitch;
	}

	game::PlayerID GetPlayer() const {
		return m_Player;
	}

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

}  // namespace protocol
}  // namespace blitz
