#pragma once

#include "td/protocol/Protocol.h"
#include "td/game/BaseGame.h"

namespace td {
namespace protocol {

class MobState {
	using Point = utils::shape::Point;
private:
	game::MobID m_MobID;
	Point m_MobPosition;
	float m_MobLife;
	game::Direction m_MobDirection;
public:
	MobState() {}
	MobState(game::MobID id, const Point& position, float life, game::Direction direction) :
		m_MobID(id), m_MobPosition(position), m_MobLife(life), m_MobDirection(direction) {
	}

	game::MobID GetMobId() const { return m_MobID; }
	Point GetMobPosition() const { return m_MobPosition; }
	float GetMobLife() const { return m_MobLife; }
	game::Direction GetMobDirection() const { return m_MobDirection; }
};

class UpdateMobStatesPacket : public Packet {
private:
	std::vector<MobState> m_MobStates;
public:
	UpdateMobStatesPacket() {}
	virtual ~UpdateMobStatesPacket() {}

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

	void addMobState(MobState mobState) { m_MobStates.push_back(mobState); }

	const std::vector<MobState>& GetMobStates() const { return m_MobStates; }

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

} // namespace protocol
} // namespace td
