#pragma once

#include "../../../GAME_COMMON.h"
#include "../../ecs_entity.h"

#include "component_character.h"
#include "../action/component_action_on_delete_drop_goodies.h"
#include "../action/component_action_delete_on_dead.h"
#include "../action/component_action_damage.h"
#include "../action/component_action_on_out_of_bounds_delete.h"
#include "../stat/component_level.h"

#define COMPONENT_ENEMY_ALLEGIANCE ALLEGIANCE_ENEMY
#define COMPONENT_ENEMY_ACTION_DAMAGE_ATTACK_TYPE ALLEGIANCE_PLAYER
#define COMPONENT_ENEMY_ACTION_DAMAGE_VALUE 1
#define COMPONENT_ENEMY_ACTION_DAMAGE_TIMER 60
#define COMPONENT_ENEMY_ACTION_DELETE_ON_TOUCH_GAME_ENTITY_TYPE GAME_ENTITY_PLAYER

typedef struct ComponentEnemy
{
	ECSComponent component;
	Vector* entityList;
} ComponentEnemy;

void
component_enemy_init
(
	ComponentEnemy* self,
	ECS* ecs,
	Texture texture,
	ivec2 frameSize,
	ivec2 atlasSize,
	vec2 size,
	vec2 physicsSize,
	vec3 position,
	f32 friction,
	f32 velocityMax,
	u32 healthValue,
	bool isBounce,
	bool isAffectedByGravity,
	bool isSolid,
	u32 goodieCount,
	u32 levelValue,
	Vector* entityList
);

static const Rectangle ENEMY_ACTION_ON_OUT_OF_BOUNDS_DELETE_RECTANGLE = 
{
	.x = -500,
	.y = -500,
	.w = 3000,
	.h = 3000
};

void component_enemy_add(ComponentEnemy* self, ECS* ecs);
void component_enemy_delete(ComponentEnemy* self, ECS* ecs);

static const ECSComponentInfo COMPONENT_ENEMY_INFO = 
{
	.system = 
	{
		.functions = 
		{ 
			(ECSFunction)component_enemy_add,
			(ECSFunction)component_enemy_delete,
			NULL,
			NULL
		}
	},
	.type = ECS_COMPONENT_ENEMY,
	.size = sizeof(ComponentEnemy)
};


