/*
* Copyright (C) 2026, KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 */

#ifndef AUTOTEST_FAKE_UKUI_SEARCH_TASK_H
#define AUTOTEST_FAKE_UKUI_SEARCH_TASK_H

#include <QObject>
#include <QStringList>

#include "ukui-search/data-queue.h"
#include "ukui-search/result-item.h"
#include <ukui-search/search-result-property.h>

namespace UkuiSearch {

namespace FakeSearchStore {
extern QStringList g_resultIds;
extern QString g_lastKeyword;
extern bool g_stopCalled;
void reset();
}

class UkuiSearchTask : public QObject
{
public:
    explicit UkuiSearchTask(QObject *parent = nullptr);
    ~UkuiSearchTask() override;

    DataQueue<ResultItem> *init();
    void initSearchPlugin(SearchProperty::SearchType searchType, const QString &customSearchType = QString());
    bool setResultProperties(SearchProperty::SearchType searchType, SearchResultProperties searchResultProperties);
    void setSearchOnlineApps(bool searchOnlineApps);
    void clearKeyWords();
    void addKeyword(const QString &keyword);
    size_t startSearch(SearchProperty::SearchType searchtype, QString customSearchType = QString());
    void stop();

private:
    DataQueue<ResultItem> m_queue;
};

}

#endif
