#ifndef TRANSFORMCOMPONENT_HPP
#define TRANSFORMCOMPONENT_HPP

#include "TinyMath.hpp"
#include "Component.hpp"
#include <string>

/**
 * A Component implementation to hold the position of a GameObject.
 * Used by every other Component that needs a position.
 */
class TransformComponent : public Component {
public:
    /**
     * Construct a new Transform Component object.
     * 
     * @param _x the x position of the TransformComponent
     * @param _y the y position of the TransformComponent
     */
    TransformComponent(int _x, int _y);

    /**
     * Destroy the Transform Component object.
     */
    ~TransformComponent();

    /**
     * Set the position of the TransformComponent.
     * 
     * @param _pos the new position of the TransformComponent
     * @see #SetTransform(int, int) 
     */
    void SetTransform(Vec2D _pos);

    /**
     * Set the position of the TransformComponent.
     * 
     * @param _x the new x position of the TransformComponent
     * @param _y the new y position of the TransformComponent
     * @see #SetTransform(Vec2D) 
     */
    void SetTransform(int _x, int _y);

    void Update(SDL_Event e, int frame, std::vector<std::string> broadcastList) override;

    void Render(SDL_Renderer *ren) override;

    void ShowComponentEditor(bool* showEditor) override;

    /**
     * Get the position of the TransformComponent.
     * 
     * @return the current position of the TransformComponent
     */
    Vec2D getPos() const;

    const char* ComponentTypeName() override {return "Transform Component";}

private:
    Vec2D position;
    std::vector<ComponentTag> tags = {ComponentTag::Position};
};

#endif
