#pragma once

#include "component/COMPONENT_COMMON.h"

#include "../../engine/vector.h"

#define ECS_FUNCTION_COUNT ECS_FUNCTION_DRAW + 1
typedef enum ECSFunctionType
{
	ECS_FUNCTION_ADD,
	ECS_FUNCTION_DELETE,
	ECS_FUNCTION_TICK,
	ECS_FUNCTION_DRAW
} ECSFunctionType;

typedef struct ECS ECS;
typedef struct Game Game;

typedef void (*ECSFunction)(void*, ECS*);

typedef struct ECSComponent
{
	u32 id;
	bool isDisabled;
	bool isFunctionDisabled[ECS_FUNCTION_COUNT];
} ECSComponent;

typedef struct ECSsystem
{
	ECSFunction functions[ECS_FUNCTION_COUNT];
} ECSSystem;

typedef struct ECSComponentInfo
{
	ECSSystem system;
	ECSComponentType type;
	size_t size;
} ECSComponentInfo;

typedef struct ECSComponentList
{
	ECS* ecs;
	ECSSystem system;
	ECSComponentType type;
	Vector components; /* whatever type is being used */
} ECSComponentList;

typedef struct ECS
{
	Game* game;
	ECSComponentList lists[ECS_COMPONENT_COUNT];
	u32 nextID;
} ECS;

