#pragma once
#include "graphics/animation.hpp"
#include "constants.hpp"
#include <SFML/Graphics/RenderTexture.hpp>

namespace components {
  struct Storyboard;
}

namespace cinematic {
  struct Camera {
    animation::Animation anim;
    sf::Vector2f size{SCREEN_WIDTH, SCREEN_HEIGHT};
    sf::Vector2f base_size{SCREEN_WIDTH, SCREEN_HEIGHT};
    sf::Vector2f aimed_at{0,0};
    sf::Vector2f going_to{0,0};
    sf::FloatRect camera_bounds{{0,0},{SCREEN_WIDTH, SCREEN_HEIGHT}};
    sf::View view;

    Camera(sf::Vector2f size, const std::string &name);

    void resize(float width);
    void scale(float ratio);
    void position(float x, float y);
    void move(float x, float y);
    bool playing();
    void update();
    void render(sf::RenderTexture& target);
    void play();
    void style(const std::string &name);
    void reset(sf::RenderTexture& target);
    void update_camera_bounds(sf::Vector2f size);
    void from_story(components::Storyboard& story);
  };

  void init();
}
