#ifndef GAMEOBJECT_HPP
#define GAMEOBJECT_HPP

#include <vector>
#include <string>

#include "Component.hpp"

/**
 * A representation of any object in the game.
 * Has minimal functionality on its own, holds a list of Component objects which handle all game-related tasks.
 */
class GameObject {
public:
    /**
     * Construct a new Game Object
     * 
     * @param name the name of the GameObject
     */
    GameObject(std::string name);

    /**
     * Destroy the Game Object
     */
    ~GameObject();

    /**
     * Update all @link Component components @endlink within the GameObject.
     * 
     * @param e any user input
     * @param frame the current frame
     * @param broadcastList a list of messages for @link Component components @endlink to talk to each other
     * @see Engine#Update()
     * @see Component#Update()
     */
    void Update(SDL_Event e, int frame, std::vector<std::string> broadcastList);

    /**
     * Render all @link Component components @endlink within the GameObject.
     * 
     * @param ren the renderer to be drawn to
     * @see Engine#Render()
     * @see Component#Render()
     */
    void Render(SDL_Renderer *ren);

    /**
     * Add a new Component to the GameObject.
     * 
     * @param c a pointer to the Component to be added
     */
    void AddComponent(Component *c);

    /**
     * Remove a Component from the GameObject.
     * 
     * @param c a pointer to the Component to be removed
     */
    void RemoveComponent(Component *c);

    /**
     * Gets a list of all @link Component components @endlink within the GameObject.
     * 
     * @return const std::vector<Component*> 
     */
    const std::vector<Component*> ListComponents();

    /**
     * Gets the name of the GameObject.
     * 
     * @return the name of the GameObject
     */
    std::string GetName();

private:
    std::vector<Component *> m_components;
    std::string m_name;

};

#endif
