if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
if not WeakAurasSaved.Cyka.Cache then WeakAurasSaved.Cyka.Cache = {} end
if not WeakAurasSaved.Cyka.Cache.PlayerInfo then WeakAurasSaved.Cyka.Cache.PlayerInfo = {} end

local allianceRaces = {
	"Draenai",
	"Dwarf",
	"Gnome",
	"Human",
	"Night Elf",
	"Worgen",
}

PlayerController = {
	nearbyPlayers = {},
	addPlayer = function(self, name) self.nearbyPlayers[name] = Player:New(name) end,
	getPlayers = function(self) end,
	process = function(guid)
		if self.nearbyPlayers[guid] == nil then
			self.addPlayer(guid)
		else
		end
	end,
}

Player = {
	guid = nil,
	lastSighted = nil,
	info = nil,
	update = function(self) self.lastSighted = GetTime() end,
	getFormatted = function(self)
		-- Color by class
		-- Format time
		return info.name .. " " .. self.lastSighted
	end,
}
PlayerInfo = {
	class = nil,
	race = nil,
	name = nil,
	isHostile = nil,
}

function Player:New(guid)
	o = {}
	setmetatable(o, self)
	self.__index = self

	o.guid = guid or ""
	o.lastSighted = GetTime()
	o.info = PlayerInfo:New(guid)

	return o
end
function PlayerInfo:New(guid)
	o = {}
	setmetatable(o, self)
	self.__index = self

	local info
	if WeakAurasSaved.Cyka.Cache.PlayerInfo[guid] then
		info = WeakAurasSaved.Cyka.Cache.PlayerInfo[guid]
	else
		info = GetPlayerInfoByGUID(guid)
		WeakAurasSaved.Cyka.Cache.PlayerInfo[guid] = {
			class = info.class,
			race = info.race,
			name = info.name,
			isHostile = allianceRaces[race] ~= nil,
		}
	end
	o.class = info.class or ""
	o.race = info.race or ""
	o.name = info.name or ""
	o.isHostile = info.isHostile or true

	return o
end

aura_env.processEvent = function(caster, target)
	PlayerController:process(caster)
	PlayerController:process(target)
end
