#pragma once
#include "Plottable.h"
#include "../axis/Axis.h"
namespace renderive {
enum class Constellation_Diagram_Type : std::uint8_t {
    Psk4 = 4,
    Psk8 = 8,
    Psk16 = 16
};
struct Constellation_Diagram_Properties {
    Range i_range{0.0, 100.0};
    Range q_range{0.0, 100.0};
    Color point_color = Color::red();
    Color anchor_color = Color::yellow();
    Nonnegative_Count point_lifetime_ms{1000};
    Constellation_Diagram_Type type = Constellation_Diagram_Type::Psk8;
    double phase_offset_radians{};
};
namespace detail {
class LIB_DECL Constellation_Diagram_Control : public Plottable_State<Constellation_Diagram_Properties> {
public:
    Constellation_Diagram_Control(const Constellation_Diagram_Properties& properties, renderive_Owner<Axis> i_axis, renderive_Owner<Axis> q_axis);
    ~Constellation_Diagram_Control() override;
    void append_point(PointF point);
    [[nodiscard]] std::size_t point_count() const;
    void fit_square_to_axes();
protected:
    void prepare_frame(const Prepare_Render_Context& context) override;
    void paint(Painter& painter, const Paint_Render_Context& context) override;
private:
    struct Impl;
    void publish() override;
};
}
using Constellation_Diagram = detail::Attach_Plottable<detail::Constellation_Diagram_Control, Constellation_Diagram_Properties>;
}
