/*
 * SPDX-FileCopyrightText: 2026 Maciej Sopyło <me@klh.io>
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#pragma once

#include <QObject>
#include <QDBusContext>
#include <QDBusVirtualObject>
#include <QDBusAbstractAdaptor>

class ObjectProxy : public QDBusVirtualObject, protected QDBusContext
{
    Q_OBJECT
public:
    explicit ObjectProxy(QObject *parent = nullptr);

    bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override;
    QString introspect(const QString &path) const override;

protected:
    void registerVirtualObject();
    void registerAdaptor(QDBusAbstractAdaptor *adaptor);

private slots:
    void onSignal();

private:
    QString adaptorObjectPath(QObject *adaptor);
    QString adaptorService(QObject *adaptor);
};
