#pragma once
#include "../renderable/Renderable.h"
#include <renderive/base/observer/Observer.hpp>
#include <renderive/real_time_data/Frame_Strategy_Observer.hpp>
#include <renderive/real_time_data/History_Real_Time_Data.hpp>
#include <renderive/real_time_data/Latest_Real_Time_Data.hpp>
#include <mutex>
namespace renderive::detail {
using Plottable_Real_Time_Data_Observer = Observer_State<Frame_Strategy_Real_Time_Data_Observer>;
inline Plottable_Real_Time_Data_Observer observe_real_time_data(Renderable& renderable) {
    return Plottable_Real_Time_Data_Observer(Frame_Strategy_Real_Time_Data_Observer(renderable));
}
template <class Value>
class Plottable_Latest_Real_Time_Data
    : public Latest_Real_Time_Data<Value, std::mutex, Plottable_Real_Time_Data_Observer> {
    using Base = Latest_Real_Time_Data<Value, std::mutex, Plottable_Real_Time_Data_Observer>;
public:
    explicit Plottable_Latest_Real_Time_Data(Renderable& owner)
        : Base(observe_real_time_data(owner)), binding_(this->bind_renderable(owner)) {}
private:
    Real_Time_Data_Binding binding_;
};
template <class Value, class Container>
class Plottable_History_Real_Time_Data
    : public History_Real_Time_Data<Value, Container, std::mutex, Plottable_Real_Time_Data_Observer> {
    using Base = History_Real_Time_Data<Value, Container, std::mutex, Plottable_Real_Time_Data_Observer>;
public:
    explicit Plottable_History_Real_Time_Data(Renderable& owner)
        : Base(observe_real_time_data(owner)), binding_(this->bind_renderable(owner)) {}
private:
    Real_Time_Data_Binding binding_;
};
}
