#pragma once

#include <memory>
#include <string>
#include <vector>
#include <functional>

#include <QString>

class QMenu;

namespace Xybrid::Data {
    class Node;
    class Graph;
}

namespace Xybrid::Config {
    class PluginInfo {
    public:
        QString id;
        std::vector<QString> oldIds;
        QString displayName;
        QString category;
        std::function<std::shared_ptr<Data::Node>()> createInstance;
        bool hidden = false;

        PluginInfo() = default;
        virtual ~PluginInfo() = default;
    };

    namespace PluginRegistry {
        bool enqueueRegistration(std::function<void()>);
        void registerPlugin(std::shared_ptr<PluginInfo>);
        void init();

        std::shared_ptr<Data::Node> createInstance(const QString& id);
        void populatePluginMenu(QMenu*, std::function<void(std::shared_ptr<Data::Node>)>, Data::Graph* = nullptr);
    }
}
