#pragma once
#include "constants.hpp"
#include <guecs/ui.hpp>
#include "graphics/camera.hpp"
#include <SFML/Audio/Sound.hpp>
#include "game/components.hpp"

namespace storyboard {

  struct UI {
    guecs::UI $ui;
    sf::RenderTexture $view_texture;
    sf::Sprite $view_sprite;
    cinematic::Camera $camera{{SCREEN_WIDTH, SCREEN_HEIGHT}, "story"};
    std::shared_ptr<sf::Sound> $audio;
    std::string $zoom_target = "a";
    bool $moving = false;
    int cur_beat = 0;
    components::Storyboard $story;
    std::string $layout;

    UI(const std::string& story_name);

    void init();
    void update();
    void render(sf::RenderWindow &window);
    bool mouse(float x, float y, guecs::Modifiers mods);
    void zoom(const std::string &cell_name);
    void reset();
    void track_audio();
    bool playing();
    void stop();
    void config_camera(cinematic::Camera &camera);
  };

}
