/*
 * Copyright (C) 2025 UBports Foundation
 *
 * 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; version 3.
 *
 * 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 <http://www.gnu.org/licenses/>.
 *
 * Authors: Alfred Neumayer <alfred@ubports.com>
 */

#ifndef QUESTIONAIRE_H
#define QUESTIONAIRE_H

#include <QObject>

#include <functional>
#include <string>
#include <vector>

class Questionaire : public QObject
{
    Q_OBJECT

public:
    Questionaire(QObject* parent = nullptr) : QObject(parent) {}

    typedef std::function<std::string(const std::string&)> Answer;
    struct Question {
        std::string needle = "";
        Answer answer = [=](const std::string&){ return ""; };
    };
    typedef std::vector<Question> Questions;

    int run(const std::string& command, const std::string& password, const Questions& questionaire);
};

#endif // QUESTIONAIRE_H
