#pragma once

#include "component/action/component_action_damage.h"
#include "component/action/component_action_delete_on_dead.h"
#include "component/action/component_action_delete_on_timer.h"
#include "component/action/component_action_delete_on_touch_entity.h"
#include "component/action/component_action_delete_on_touch_game_entity_type.h"
#include "component/action/component_action_grip.h"
#include "component/action/component_action_gripped.h"
#include "component/action/component_action_keep_in_rectangle.h"
#include "component/action/component_action_lock.h"
#include "component/action/component_action_on_combat_hide.h"
#include "component/action/component_action_on_delete_drop_goodies.h"
#include "component/action/component_action_on_delete_give_ammo.h"
#include "component/action/component_action_on_touch_give_goodies.h"
#include "component/action/component_action_on_out_of_bounds_delete.h"
#include "component/action/component_action_redirect.h"
#include "component/action/component_action_point_to_mouse.h"
#include "component/action/component_action_return.h"
#include "component/action/component_action_follow.h"
#include "component/action/component_action_shoot.h"
#include "component/action/component_action_spawn.h"
#include "component/action/component_action_wave.h"
#include "component/animation/component_animation_color_change.h"
#include "component/animation/component_animation_cursor.h"
#include "component/animation/component_animation_levitate.h"
#include "component/animation/component_animation_move.h"
#include "component/animation/component_animation_squash.h"
#include "component/animation/component_animation_stretch.h"
#include "component/behavior/component_behavior_act_in_rectangle.h"
#include "component/behavior/component_behavior_approach_and_shoot.h"
#include "component/behavior/component_behavior_boomerang.h"
#include "component/behavior/component_behavior_chase.h"
#include "component/behavior/component_behavior_hop.h"
#include "component/component_game_object.h"
#include "component/component_physics.h"
#include "component/component_circle_collision.h"
#include "component/component_sprite.h"
#include "component/component_text.h"
#include "component/control/component_control_aim.h"
#include "component/control/component_control_lock.h"
#include "component/control/component_control_move.h"
#include "component/control/component_control_player.h"
#include "component/control/component_control_recall.h"
#include "component/control/component_control_redirect.h"
#include "component/control/component_control_shoot.h"
#include "component/control/component_control_heart.h"
#include "component/entity/component_character.h"
#include "component/entity/component_enemy.h"
#include "component/entity/component_pickup.h"
#include "component/hud/component_button.h"
#include "component/hud/component_hud_display.h"
#include "component/hud/component_stat_display.h"
#include "component/hud/component_shop_button.h"
#include "component/stat/component_shop_item.h"
#include "component/stat/component_shop.h"
#include "component/stat/component_act_entity.h"
#include "component/stat/component_allegiance.h"
#include "component/stat/component_ammo.h"
#include "component/stat/component_fatness.h"
#include "component/stat/component_game_entity_type.h"
#include "component/stat/component_goodies.h"
#include "component/stat/component_health.h"
#include "component/stat/component_heart.h"
#include "component/stat/component_invincibility.h"
#include "component/stat/component_level.h"
#include "component/stat/component_redirects.h"
#include "component/stat/component_stun.h"
#include "component/stat/component_upgrades.h"
#include "component/stat/component_wave.h"
#include "component/stat/component_timer.h"

#include "ecs_component.h"

typedef struct DrawEntry
{
	DrawObject drawObject;
	ECSFunction drawFunction;
	void* componentPointer;
} DrawEntry;

static const ECSComponentInfo ECS_COMPONENT_INFO[ECS_COMPONENT_COUNT] = 
{
	COMPONENT_ACTION_ON_DELETE_GIVE_AMMO_INFO,
	COMPONENT_ACTION_ON_DELETE_DROP_GOODIES_INFO,
	COMPONENT_ACTION_SPAWN_INFO,
	COMPONENT_ACTION_ON_HEIGHT_DAMAGE_DISABLE_INFO,
	COMPONENT_ANIMATION_COLOR_CHANGE_INFO,
	COMPONENT_ANIMATION_LEVITATE_INFO,
	COMPONENT_ANIMATION_MOVE_INFO,
	COMPONENT_ANIMATION_CURSOR_INFO,
	COMPONENT_ANIMATION_STRETCH_INFO,
	COMPONENT_ANIMATION_SQUASH_INFO,
	COMPONENT_PHYSICS_INFO,
	COMPONENT_CIRCLE_COLLISION_INFO,
	COMPONENT_ACTION_KEEP_IN_RECTANGLE_INFO,
	COMPONENT_SPRITE_INFO,
	COMPONENT_TEXT_INFO,
	COMPONENT_GAME_OBJECT_INFO,
	COMPONENT_CHARACTER_INFO,
	COMPONENT_ENEMY_INFO,
	COMPONENT_PICKUP_INFO,
	COMPONENT_BEHAVIOR_ACT_IN_RECTANGLE_INFO,
	COMPONENT_BEHAVIOR_HOP_INFO,
	COMPONENT_BEHAVIOR_BOOMERANG_INFO,
	COMPONENT_BEHAVIOR_CHASE_INFO,
	COMPONENT_BEHAVIOR_APPROACH_AND_SHOOT_INFO,
	COMPONENT_ACTION_ON_COMBAT_HIDE_INFO,
	COMPONENT_ACTION_SHOOT_INFO,
	COMPONENT_ACTION_LOCK_INFO,
	COMPONENT_ACTION_FOLLOW_INFO,
	COMPONENT_ACTION_POINT_TO_MOUSE_INFO,
	COMPONENT_ACTION_RETURN_INFO,
	COMPONENT_ACTION_REDIRECT_INFO,
	COMPONENT_ACTION_DAMAGE_INFO,
	COMPONENT_ACTION_GRIP_INFO,
	COMPONENT_ACTION_GRIPPED_INFO,
	COMPONENT_ACTION_WAVE_INFO,
	COMPONENT_CONTROL_MOVE_INFO,
	COMPONENT_CONTROL_SHOOT_INFO,
	COMPONENT_CONTROL_AIM_INFO,
	COMPONENT_CONTROL_REDIRECT_INFO,
	COMPONENT_CONTROL_LOCK_INFO,
	COMPONENT_CONTROL_RECALL_INFO,
	COMPONENT_CONTROL_HEART_INFO,
	COMPONENT_CONTROL_PLAYER_INFO,
	COMPONENT_SHOP_INFO,
	COMPONENT_SHOP_ITEM_INFO,
	COMPONENT_ACT_ENTITY_INFO,
	COMPONENT_HEALTH_INFO,
	COMPONENT_INVINCIBILITY_INFO,
	COMPONENT_STUN_INFO,
	COMPONENT_LEVEL_INFO,
	COMPONENT_WAVE_INFO,
	COMPONENT_TIMER_INFO,
	COMPONENT_AMMO_INFO,
	COMPONENT_GOODIES_INFO,
	COMPONENT_FATNESS_INFO,
	COMPONENT_REDIRECTS_INFO,
	COMPONENT_ALLEGIANCE_INFO,
	COMPONENT_GAME_ENTITY_TYPE_INFO,
	COMPONENT_UPGRADES_INFO,
	COMPONENT_HEART_INFO,
	COMPONENT_BUTTON_INFO,
	COMPONENT_SHOP_BUTTON_INFO,
	COMPONENT_STAT_DISPLAY_INFO,
	COMPONENT_HUD_DISPLAY_INFO,
	COMPONENT_ACTION_ON_TOUCH_GIVE_GOODIES_INFO,
	COMPONENT_ACTION_DELETE_ON_DEAD_INFO,
	COMPONENT_ACTION_DELETE_ON_TIMER_INFO,
	COMPONENT_ACTION_DELETE_ON_TOUCH_ENTITY_INFO,
	COMPONENT_ACTION_DELETE_ON_TOUCH_GAME_ENTITY_TYPE_INFO,
	COMPONENT_ACTION_ON_OUT_OF_BOUNDS_DELETE_INFO
};

void ecs_tick(ECS* self);
void ecs_draw(ECS* self);
void ecs_init(ECS* self, Game* game);
void ecs_clear(ECS* self);
void ecs_free(ECS* self);
