#pragma once
#include <string>

#include "SFML/Graphics/RenderWindow.hpp"
#include "SFML/Graphics/Sprite.hpp"
#include "SFML/Graphics/Texture.hpp"

class DrawableEntity {
protected:
    sf::Texture texture;
    sf::Sprite sprite;
    sf::Vector2f position, startPosition, targetPosition;
    float moveDuration = 0.f, moveElapsed = 0.f;
    bool moving = false;

    void _setPosition(const float x, const float y);
public:
    DrawableEntity(const float x, const float y, const std::string& texturePath);

    sf::Sprite& getSprite();

    void loadTexture(const std::string& texturePath);
    void _setTexture(const sf::Texture& _texture);

    void moveTo(const float x, const float y, const float timeToMove = 0.f);

    bool isMoving() const;

    sf::Vector2f getPosition() const {
        return position;
    };

    sf::Vector2i getRelativePosition() const;

    int getHeight() const;

    void render(sf::RenderWindow& window);

    void update(const float deltaTime);
};
