#ifndef FIGHT_PROP_H
#define FIGHT_PROP_H

#include "physics_entity.h"
#include "behaviour_entity.h"
#include "transformable.h"
#include "drop.h"
#include "transform.h"
#include "sprite.h"
#include "rigidbody.h"
#include "collider.h"

typedef struct Prop {
    Transform transform;
    Sprite* sprite;
    RigidBody* rigidbody;
    Collider* collisionShape;
} Prop;

Prop* MakeProp(Sprite* sprite, Shape* shape);
Prop* SpawnProp(Vector location, Sprite* sprite, Shape* shape, Vector origin);
void DestroyProp(Prop* self);

void PropStart(Prop* self);
void PropUpdate(Prop* self, float deltaTime);
void PropDraw(Prop* self);

void PropOnCollision(Prop* self, Collision collision);
void PropOnOverlap(Prop* self, Collider* other);

Transform* PropGetTransform(Prop* self);
RigidBody* PropGetRigidBody(Prop* self);

void* PropReceiveMessage(Prop* self, MessageID message, void* data);

static long PropGetDepth(Prop* self) { return -(int)(self->transform.position.y * 1000); }

impl_MessageReceiver_for(Prop,
    PropReceiveMessage
)

impl_Transformable_for(Prop,
    PropGetTransform
)

impl_PhysicsEntity_for(Prop,
    PropGetRigidBody,
    PropOnCollision,
    PropOnOverlap
)

impl_Drop_for(Prop,
    DestroyProp
)

impl_BehaviourEntity_for(Prop,
    PropStart,
    PropUpdate,
    PropDraw,
    PropGetDepth
)

#endif // !FIGHT_PROP_H
