#pragma once

class Script;
class TESForm;
class TESObjectREFR;

namespace EventManager
{
	enum eEventID {
		kEventID_OnHit,
		kEventID_OnHitWith,
		kEventID_OnMagicEffectHit,
		kEventID_OnActorEquip,
		kEventID_OnDeath,
		kEventID_OnMurder,
		kEventID_OnKnockout,
		kEventID_OnActorUnequip,
		kEventID_OnAlarm_Trespass,
		kEventID_OnAlarm_Steal,
		kEventID_OnAlarm_Attack,
		kEventID_OnAlarm_Pickpocket,
		kEventID_OnAlarm_Murder,
		kEventID_OnPackageChange,
		kEventID_OnPackageStart,
		kEventID_OnPackageDone,
		kEventID_OnStartCombat,

		kEventID_GameEventMAX,

		kEventID_LoadGame = kEventID_GameEventMAX,
		kEventID_SaveGame,
		kEventID_ExitGame,
		kEventID_ExitToMainMenu,
		kEventID_QQQ,

		kEventID_MAX,
	};

	struct EventCallback
	{
		EventCallback(Script* funcScript, TESObjectREFR* sourceFilter = NULL, TESForm* objectFilter = NULL)
			: script(funcScript), source(sourceFilter), object(objectFilter) { }
		~EventCallback() { }

		Script			* script;
		TESObjectREFR	* source;
		TESForm			* object;
	};

	bool SetHandler(const char* id, EventCallback& handler);
	bool RemoveHandler(const char* id, EventCallback& handler);
	bool RemoveHandler(const char* id, Script* fnScript);

	void HandleGameEvent(UInt32 eventMask, TESObjectREFR* source, TESForm* object);
	void HandleOBSEMessage(UInt32 msgID, void* data);

};
