#pragma once
#include "levelmanager.hpp"
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/System/Clock.hpp>
#include "stats.hpp"
#include "overlay_ui.hpp"
#include "raycaster.hpp"
#include "camera.hpp"
#include <optional>

namespace gui {

  class MainUI {
    public:
    int $compass_dir = 0;
    std::array<std::string, 8> $compass{
      "E", "SE", "S", "SW", "W", "NW", "N", "NE"
    };
    bool $show_level = false;
    bool $needs_render = true;
    Stats $stats;
    sf::Clock $clock;
    sf::RenderWindow& $window;
    GameLevel $level;
    OverlayUI $overlay_ui;
    Raycaster $rayview;
    CameraLOL $camera;

    MainUI(sf::RenderWindow& window);

    void mouse(int x, int y);
    void debug();
    void draw_stats();
    void draw_blood();

    void plan_rotate(int dir);
    bool play_rotate();
    std::optional<Point> play_move();
    Point plan_move(int dir, bool strafe);
    void abort_plan();
    void update_level(GameLevel level);

    void init();
    void render();
    void dirty();

    void show_level();
    void dead_entity(DinkyECS::Entity entity);
  };
}
