#ifndef AUTOTESTS_WINDOWS_STUB_SHARED_ENGINE_VIEW_H
#define AUTOTESTS_WINDOWS_STUB_SHARED_ENGINE_VIEW_H

#include <QQmlContext>
#include <QQmlEngine>
#include <QQuickItem>
#include <QQuickWindow>
#include <QScreen>

namespace UkuiQuick {

class SharedEngineView : public QQuickWindow
{
    Q_OBJECT
public:
    enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView };

    static QQmlEngine *sharedEngine();

    explicit SharedEngineView(QWindow *parent = nullptr);
    QQmlEngine *engine() const;
    QQmlContext *rootContext() const;
    QQuickItem *rootObject() const;
    void setResizeMode(SharedEngineView::ResizeMode resizeMode);
    SharedEngineView::ResizeMode resizeMode() const;
    void setTestRootObject(QQuickItem *item);

public Q_SLOTS:
    void setSource(const QUrl &source) const;

private:
    QQmlContext *m_context = nullptr;
    QQuickItem *m_rootObject = nullptr;
    ResizeMode m_resizeMode = SizeViewToRootObject;
    mutable QUrl m_source;
};

} // namespace UkuiQuick

#endif
