#pragma once

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

#include "../component_game_object.h"
#include "../animation/component_animation_color_change.h"
#include "../action/component_action_delete_on_touch_game_entity_type.h"
#include "../action/component_action_delete_on_timer.h"
#include "../action/component_action_gripped.h"

#define COMPONENT_PICKUP_ANIMATION_COLOR_CHANGE_FROM_COLOR (f32*)COLOR_OPAQUE
#define COMPONENT_PICKUP_ANIMATION_COLOR_CHANGE_TO_COLOR (f32*)COLOR_TRANSPARENT
#define COMPONENT_PICKUP_ANIMATION_COLOR_CHANGE_MODE ANIMATION_COLOR_CHANGE_MODE_STICK
#define COMPONENT_PICKUP_GAME_OBJECT_IS_SOLID false
#define COMPONENT_PICKUP_GAME_OBJECT_IS_AFFECTED_BY_GRAVITY true
#define COMPONENT_PICKUP_GAME_OBJECT_IS_BOUNCE true

typedef struct ComponentPickup
{
	ECSComponent component;
	u32 fadeThreshold;
	bool isHitFadeThreshold;
} ComponentPickup;

void
component_pickup_init
(
 	ComponentPickup* self,
	ECS* ecs,
	Texture texture,
	ivec2 frameSize,
	ivec2 atlasSize,
	vec2 size,
	vec2 physicsSize,
	vec3 position,
	f32 friction,
	f32 velocityMax,
	vec3 velocity,
	f32 height,
	u32 time,
	u32 fadeThreshold,
	GameEntityType type
);

void component_pickup_add(ComponentPickup* self, ECS* ecs);
void component_pickup_delete(ComponentPickup* self, ECS* ecs);
void component_pickup_tick(ComponentPickup* self, ECS* ecs);

static const ECSComponentInfo COMPONENT_PICKUP_INFO = 
{
	.system = 
	{
		.functions = 
		{ 
			(ECSFunction)component_pickup_add,
			(ECSFunction)component_pickup_delete,
			(ECSFunction)component_pickup_tick,
			NULL
		}
	},
	.type = ECS_COMPONENT_PICKUP,
	.size = sizeof(ComponentPickup)
};


