#pragma once

#include <memory>

#include <QGraphicsScene>
#include <QGraphicsView>

namespace Xybrid::Data { class Graph; }

namespace Xybrid::UI {
    class PatchboardScene : public QGraphicsScene {
        std::shared_ptr<Data::Graph> graph;
        QGraphicsView* view;

        bool resizeQueued = false;
        void queueResize();
        void autoSetSize();

    public:
        PatchboardScene(QGraphicsView* view, const std::shared_ptr<Data::Graph>& graph);
        ~PatchboardScene() override = default;

        void drawBackground(QPainter*, const QRectF&) override;

        void contextMenuEvent(QGraphicsSceneContextMenuEvent*) override;

        void refresh();
    };
}
