// Copyright (c) 2023 Alex Diener. All rights reserved.

#ifndef __EntityPlayer_H__
#define __EntityPlayer_H__

typedef struct EntityPlayer EntityPlayer;
#define EntityPlayer_superclass GameEntity

#include "gamemath/Vector2i.h"
#include "PROJECT_NAME/EntityComponent_attack.h"
#include "PROJECT_NAME/EntityComponent_collidable.h"
#include "PROJECT_NAME/EntityComponent_facing.h"
#include "PROJECT_NAME/EntityComponent_movement.h"
#include "PROJECT_NAME/EntityComponent_playerSteering.h"
#include "PROJECT_NAME/EntityComponent_position.h"
#include "PROJECT_NAME/EntityComponent_pusher.h"
#include "PROJECT_NAME/EntityComponent_sprite.h"
#include "PROJECT_NAME/GameEntity.h"
#include "PROJECT_NAME/SharedDefinitions.h"

#define EntityPlayer_ivars \
	GameEntity_ivars \
	\
	bool dead; \
	EntityComponent_attack attackComponent; \
	EntityComponent_collidable collidableComponent; \
	EntityComponent_facing facingComponent; \
	EntityComponent_movement movementComponent; \
	EntityComponent_position positionComponent; \
	EntityComponent_sprite spriteComponent; \
	EntityComponent_playerSteering steeringComponent; \
	EntityComponent_pusher pusherComponent;

#define EntityPlayer_vtable(self_type) \
	GameEntity_vtable(self_type)

stemobject_declare(EntityPlayer)

EntityPlayer * EntityPlayer_create(Vector2i position, struct RoomState * roomState);
bool EntityPlayer_init(EntityPlayer * self, Vector2i position, struct RoomState * roomState);
EntityPlayer * EntityPlayer_createWithEncodedState(struct memreadContext * memreadContext, struct RoomState * roomState);
void EntityPlayer_initWithEncodedState(EntityPlayer * self, struct memreadContext * memreadContext, struct RoomState * roomState);
EntityPlayer * EntityPlayer_copy(EntityPlayer * self, struct RoomState * roomState);
void EntityPlayer_initCopy(EntityPlayer * self, compat_type(EntityPlayer *) original, struct RoomState * roomState);
void EntityPlayer_dispose(EntityPlayer * self);
compat_type(GameEntityComponent *) EntityPlayer_getComponent(EntityPlayer * self, ComponentType type);
void EntityPlayer_preadvance(EntityPlayer * self);
void EntityPlayer_advanceTurn(EntityPlayer * self);
bool EntityPlayer_isEqual(EntityPlayer * self, EntityPlayer * compare);
void EntityPlayer_enumerateProperties(EntityPlayer * self, bool transient, GameEntity_enumeratePropertiesCallback callback, void * context);
void EntityPlayer_undoActionPerformed(EntityPlayer * self);

void EntityPlayer_setFacing(EntityPlayer * self, FacingDirection facing);
bool EntityPlayer_startMoveInput(EntityPlayer * self, MoveInput_axis axis, MoveInput_direction direction, bool repeat);
bool EntityPlayer_stopMoveInput(EntityPlayer * self, MoveInput_axis axis, MoveInput_direction direction);
bool EntityPlayer_startActionInput(EntityPlayer * self, ActionInput_action action, bool repeat);
bool EntityPlayer_stopActionInput(EntityPlayer * self, ActionInput_action action);
void EntityPlayer_offsetLocalPosition(EntityPlayer * self, Vector2i offset);

#endif
