#pragma once


#pragma pack(push, 1)
enum class EventCode : uint8_t
{
	PlayerSpawn = 0,
	PlayerUpdate,
	PlayerDie,
	PlayerCast,
	PlayerHealth,
	PlayerMana,
	PlayerMaxHealth,
	PlayerMaxMana,
	PlayerDealDamage,
	PlayerLevel,
	SessionEnd,

	MetaEvents = 64,

	MapData,
	MapImage,
	PlayerName,
	PlayerTeam,
	AbilityName,
};

struct PlayerSpawn
{
	PlayerSpawn() = default;
	PlayerSpawn(uint32_t time, uint8_t player, float playerX, float playerY) : event(EventCode::PlayerSpawn), time(time), player(player), playerX(playerX), playerY(playerY) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	float playerX;
	float playerY;
};
struct PlayerUpdate
{
	PlayerUpdate() = default;
	PlayerUpdate(uint32_t time, uint8_t player, float playerX, float playerY) : event(EventCode::PlayerUpdate), time(time), player(player), playerX(playerX), playerY(playerY) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	float playerX;
	float playerY;
};
struct PlayerDie
{
	PlayerDie() = default;
	PlayerDie(uint32_t time, uint8_t player, uint8_t source) : event(EventCode::PlayerDie), time(time), player(player), source(source) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	uint8_t source;
};
struct PlayerCast
{
	PlayerCast() = default;
	PlayerCast(uint32_t time, uint8_t player, uint32_t ability) : event(EventCode::PlayerCast), time(time), player(player), ability(ability) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	uint32_t ability;
};
struct PlayerHealth
{
	PlayerHealth() = default;
	PlayerHealth(uint32_t time, uint8_t player, int32_t health) : event(EventCode::PlayerHealth), time(time), player(player), health(health) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	int32_t health;
};
struct PlayerMana
{
	PlayerMana() = default;
	PlayerMana(uint32_t time, uint8_t player, int32_t mana) : event(EventCode::PlayerMana), time(time), player(player), mana(mana) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	int32_t mana;
};
struct PlayerMaxHealth
{
	PlayerMaxHealth() = default;
	PlayerMaxHealth(uint32_t time, uint8_t player, int32_t maxHealth) : event(EventCode::PlayerMaxHealth), time(time), player(player), maxHealth(maxHealth) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	int32_t maxHealth;
};
struct PlayerMaxMana
{
	PlayerMaxMana() = default;
	PlayerMaxMana(uint32_t time, uint8_t player, int32_t maxMana) : event(EventCode::PlayerMaxMana), time(time), player(player), maxMana(maxMana) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	int32_t maxMana;
};
struct PlayerDealDamage
{
	PlayerDealDamage() = default;
	PlayerDealDamage(uint32_t time, uint8_t player, uint32_t ability, int32_t damage) : event(EventCode::PlayerDealDamage), time(time), player(player), ability(ability), damage(damage) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	uint32_t ability;
	int32_t damage;
};
struct PlayerLevel
{
	PlayerLevel() = default;
	PlayerLevel(uint32_t time, uint8_t player, uint8_t level) : event(EventCode::PlayerLevel), time(time), player(player), level(level) {}
	EventCode event;
	uint32_t time;
	uint8_t player;
	uint8_t level;
};
struct SessionEnd
{
	SessionEnd() = default;
	SessionEnd(uint32_t time) : event(EventCode::SessionEnd), time(time) {}
	EventCode event;
	uint32_t time;
};

struct MapData
{
	MapData() = default;
	MapData(float minX, float maxX, float minY, float maxY) : event(EventCode::MapData), minX(minX), maxX(maxX), minY(minY), maxY(maxY) {}
	EventCode event;
	float minX;
	float maxX;
	float minY;
	float maxY;
};
struct MapImage
{
	MapImage() = default;
	MapImage(uint32_t width, uint32_t height) : event(EventCode::MapImage), width(width), height(height) {}
	EventCode event;
	uint32_t width;
	uint32_t height;
};
struct PlayerName
{
	PlayerName() = default;
	PlayerName(uint8_t player, uint16_t length) : event(EventCode::PlayerName), player(player), length(length) {}
	EventCode event;
	uint8_t player;
	uint16_t length;
};
struct PlayerTeam
{
	PlayerTeam() = default;
	PlayerTeam(uint8_t player, uint8_t team) : event(EventCode::PlayerTeam), player(player), team(team) {}
	EventCode event;
	uint8_t player;
	uint8_t team;
};
struct AbilityName
{
	AbilityName() = default;
	AbilityName(uint32_t ability, uint16_t length) : event(EventCode::AbilityName), ability(ability), length(length) {}
	EventCode event;
	uint32_t ability;
	uint16_t length;
};
#pragma pack(pop)