#ifndef AUTOTEST_WIDGET_LOADER_H
#define AUTOTEST_WIDGET_LOADER_H

#include <QObject>
#include <QStringList>

#include "widget-metadata.h"

namespace UkuiQuick {

class Widget;

struct WidgetLoaderStubState
{
    bool containerLoadSucceeds = true;
    bool containerItemLoadSucceeds = true;
    bool widgetLoadSucceeds = true;
    int loadCalls = 0;
    int addPathCalls = 0;
    int setFilterCalls = 0;
    QStringList loadedIds;
    QStringList searchPaths;
    WidgetMetadata::Hosts lastHosts = WidgetMetadata::Undefined;
};

WidgetLoaderStubState &widgetLoaderStubState();
void resetWidgetLoaderStubState();

class WidgetLoader : public QObject
{
    Q_OBJECT
public:
    explicit WidgetLoader(QObject *parent = nullptr);

    Widget *loadWidget(const QString &id);
    void addWidgetSearchPath(const QString &path);
    void setShowInFilter(WidgetMetadata::Hosts hosts);
};

} // namespace UkuiQuick

#endif // AUTOTEST_WIDGET_LOADER_H
