#pragma once

#include <cstdint>
#include <memory>
#include <vector>
#include "renderive/capture/Capture_Types.hpp"
#include "renderive/renderable/Renderable_Configuration.hpp"
#include "renderive/renderable/Renderable_Id.hpp"
#include "renderive/renderable/base/Renderive_Owner.hpp"
#include "renderive/state/Render_State_View.hpp"
#include "Frame_Viewport.hpp"

class Color_Cache;
class Renderable_Base;
class Scene_Base;
struct Renderable_Graph;

class Renderable_Frame_State {
public:
    Renderable_Id renderable_id{};
    bool visible{true};
    Renderable_Configuration configuration;
    std::uint64_t prepare_revision{};
    std::uint64_t prepared_revision{};
    std::uint64_t paint_revision{};
    std::uint64_t painted_revision{};
    std::uint64_t painted_prepare_revision{};
    bool prepare_required{};
    bool paint_required{};
    std::shared_ptr<const Renderable_Graph> render_graph;
    std::vector<Renderable_Id> dependency_parent_ids;

private:
    friend class Scene_Base;
    renderive_Owner<Renderable_Base> owner_;
    std::shared_ptr<Color_Cache> paint_buffer_;
};

class Frame_Render_Snapshot {
public:
    std::uint64_t render_sequence{};
    Frame_Viewport viewport;
    Render_State_View render_state;
    std::vector<Renderable_Frame_State> renderables;
    std::vector<Renderable_Id> display_order;

private:
    friend class Scene_Base;
    std::uint64_t scene_state_revision_{};
    std::uint64_t next_refresh_interval_ns_{};
    Capture_Frame_Ticket capture_ticket_;
};
