#pragma once
#include "SFML/Graphics/Text.hpp"
#include "SFML/Graphics/RenderWindow.hpp"

class Label {
private:
    sf::Text labelText;
    bool center;
    bool outline;
    bool darkMode = false;
public:
    Label(const std::string &labelString, sf::Vector2f position, const bool _center = false, const bool _outline = true);

    void setText(const std::string &labelString);
    void setPosition(const sf::Vector2f position);
    void setFillColor(const sf::Color color) {
        labelText.setFillColor(color);
    };
    void setOutlineColor(const sf::Color color) {
        labelText.setOutlineColor(color);
    };
    sf::FloatRect getBounds() const {
        return labelText.getGlobalBounds();
    };
    void render(sf::RenderWindow& window) const;

    void setDarkMode(const bool _darkMode) {
        darkMode = _darkMode;

        labelText.setFillColor(darkMode ? sf::Color::Black : sf::Color::White);
        if (outline) {
            labelText.setOutlineColor(darkMode ? sf::Color::White : sf::Color::Black);
            labelText.setOutlineThickness(2);
        }
    };
};
