#ifndef PLAYER_H
#define PLAYER_H

#include "networld.h"

enum turnPhases {init, recruitment, attack};
typedef enum turnPhases TurnPhases;

struct Str_Player{
    int ID;
    Node ** nodes;
    int nodeCount;
    Color color;
    TurnPhases turnPhase;
    int soldiers;
    Node * selectedNode;
    bool hasSelectedNode;
};

typedef struct Str_Player Player;

// Constructor / Destructor
/**
 * @brief     Construct all the elements of an empty Player.
 * @param     self an empty Player not yet constructed.
 * @return    The pointer to the new Player.
 */
void Player_construct(Player * self, int id, Color color);

/**
 * @brief     Allocate the memory to store a Player
 * @return    The pointer to the new Player.
 */
Player * Player_new();

/**
 * @brief     Allocate 'size' Players.
 * @return    The pointer to the new array of 'size' Player.
 */
Player * Player_newArray(int size, Color colors[]);

/**
 * @brief    Destructor.
 */
void Player_delete(
    //! the Player to delete
    Player * self
);

/**
 * @brief  Add a node to the player's territory.
 */
void Player_add_Node(
    //! The player;
    Player * self,
    //! The Node to add
    Node * node

);

/**
 * @brief  Remove a node to the player's territory.
 */
void Player_remove_Node(
    //! The player;
    Player *  self,
    //! The Node to remove
    Node * node
);

/**
 * @brief Start a player's turn and take all actions before player's first input
 */
void Player_start_turn(Player * self);


/**
 * @brief End a player's turn
 */
void Player_end_turn(Player * self);

void Player_add_soldier(Player * self, Vector2 mousePos);

void Player_remove_soldier(Player * self, Vector2 mousePos);

void Player_select_Node(Player * self, Vector2 mousePos);

void Player_unselect_Node(Player * self, Vector2 mousePos);

void Player_attack_Node(Player * self, Player * defender, Node * originNode, Node * targetNode);

void Player_confirm_recrutement(Player * self);

#endif