#pragma once
#include "levelmanager.hpp"
#include "constants.hpp"
#include <deque>
#include "textures.hpp"
#include "guecs.hpp"
#include "rituals.hpp"

namespace gui {
  enum class RitualUIState {
    OPEN=0,
    CLOSED=1,
    OPENING=2,
    CLOSING=3
  };

  class RitualUI {
    public:
      sf::IntRect $ritual_closed_rect{{0,0},{380,720}};
      sf::IntRect $ritual_open_rect{{380 * 2,0},{380,720}};
      ritual::Engine $engine;
      ritual::CraftingState $blanket;
      RitualUIState $ritual_state = RitualUIState::CLOSED;
      textures::SpriteTexture $ritual_ui;
      components::Animation $ritual_anim;
      guecs::UI $gui;
      GameLevel $level;

      RitualUI(GameLevel level);
      bool mouse(float x, float y, bool hover);
      void toggle();
      bool is_open();
      void init();
      void render(sf::RenderWindow &window);
      void update();

      void ritual_circle_clicked(DinkyECS::Entity ent);
      void inv_slot_clicked(DinkyECS::Entity ent);
      void reset_inv_positions();
  };
}
