#pragma once

#include "guecs/sfml/backend.hpp"
#include "guecs/sfml/components.hpp"
#include "guecs/ui.hpp"
#include <nlohmann/json.hpp>
#include <memory>

struct Slide {
  guecs::UI $gui;
  std::wstring $title;
  std::wstring $content;
  nlohmann::json $config;
  bool $initialized = false;

  Slide(const std::string& title, const std::string& content, nlohmann::json& config);

  Slide() {}

  void init(lel::Cell& cell);
  void render(sf::RenderWindow& window);
};

using SlideDeck = std::vector<Slide>;

struct SlidesUI {
  guecs::UI $gui;
  std::shared_ptr<SlideDeck> $slides = nullptr;
  size_t $current = 0;

  SlidesUI(std::shared_ptr<SlideDeck> slides);
  void init();
  Slide& current();

  void next_slide();
  void prev_slide();
  void show_slide();
  void render(sf::RenderWindow& window);
  void mouse(float x, float y, guecs::Modifiers mods);
};
