#ifndef AUTOTESTS_UTILS_STUB_APP_MANAGER_H
#define AUTOTESTS_UTILS_STUB_APP_MANAGER_H

#include <QObject>
#include <QString>

namespace Sidebar {

class AppManager : public QObject
{
public:
    explicit AppManager(QObject *parent = nullptr)
        : QObject(parent)
    {
    }

    static AppManager *getInstance(QObject *parent = nullptr)
    {
        Q_UNUSED(parent)
        static AppManager manager;
        return &manager;
    }

    static void resetTestData()
    {
        s_launchCount = 0;
        s_lastDesktopFile.clear();
        s_lastApplicationName.clear();
    }

    static int launchCount()
    {
        return s_launchCount;
    }

    static QString lastDesktopFile()
    {
        return s_lastDesktopFile;
    }

    static QString lastApplicationName()
    {
        return s_lastApplicationName;
    }

    void launchApp(const QString &desktopFile, const QString &applicationName)
    {
        ++s_launchCount;
        s_lastDesktopFile = desktopFile;
        s_lastApplicationName = applicationName;
    }

private:
    inline static int s_launchCount = 0;
    inline static QString s_lastDesktopFile;
    inline static QString s_lastApplicationName;
};

} // namespace Sidebar

#endif
