#pragma once

#include "GameTypes.h"

class TESObjectREFR;
class BSTask;

// 18
class IOTask	// derived from BSTask
{
public:
	virtual void Unk_00(void) = 0;

	// void** vtbl
	UInt32	unk04;			// 004 not initialized
	UInt32  unk08;			// 008 init to 0
	UInt32	unk0C;			// 00C init to 0
	UInt32	unk10;			// 010 init to 0
	UInt32	unk14;			// 014 init to 0
};

// 34
class QueuedReference : public IOTask 
{
public:

	UInt32			unk18;			// 018 init to 0
	UInt32			unk1C;			// 01C init to 0
	TESObjectREFR	* refr;			// 020 init to c'tr arg0
	UInt32			unk24;			// 024 init to 0
	UInt32			unk28;			// 028 init to 0
	UInt32			unk2C;			// 02C init to 0
	UInt32			unk30;			// 030 init to 0
};

// 30
class BSTaskManager : public LockFreeMap< NiPointer< BSTask > >
{
public:
	virtual void Unk_0F(UInt32 arg0) = 0;
	virtual void Unk_10(UInt32 arg0) = 0;
	virtual void Unk_11(UInt32 arg0) = 0;
	virtual void Unk_12(void) = 0;
	virtual void Unk_13(UInt32 arg0) = 0;

	UInt32 unk1C;		// 1C
	UInt32 unk20;		// 20
	UInt32 unk24;		// 24
	UInt32 unk28;		// 28
	UInt32 unk2C;		// 2C
};

// 3C
class IOManager : public BSTaskManager
{
public:
	virtual void Unk_14(UInt32 arg0) = 0;

	static IOManager* GetSingleton();

	UInt32									unk30;			// 30
	LockFreeQueue< NiPointer< IOTask > >	* taskQueue;	// 34
	UInt32									unk38;			// 38

	bool IsInQueue(TESObjectREFR *refr);
	void QueueForDeletion(TESObjectREFR* refr);
	void DumpQueuedTasks();
};

