#ifndef NXTRESTTARGETRUNNER_H
#define NXTRESTTARGETRUNNER_H

#include <projectexplorer/runconfiguration.h>

namespace Nxt {
namespace Internal {

class NxtRestTargetRunner : public ProjectExplorer::SimpleTargetRunner
{
    Q_OBJECT

public:
    explicit NxtRestTargetRunner(ProjectExplorer::RunControl *runControl);

    void setRunnable(const ProjectExplorer::Runnable &runnable);

    void setDevice(const ProjectExplorer::IDevice::ConstPtr &device);
    ProjectExplorer::IDevice::ConstPtr device() const;

    QString vappName;
    QString targetName;
    QString projectName;
    QString remotePath;

protected:
    void start() override;
    void stop() override;

private:
    void onProcessStarted();
    void onProcessFinished(int exitCode, QProcess::ExitStatus status);
    void onProcessError(QProcess::ProcessError error);

    ProjectExplorer::ApplicationLauncher m_launcher;
    ProjectExplorer::Runnable m_runnable;
    ProjectExplorer::IDevice::ConstPtr m_device;
    bool m_stopReported = false;
};

} // namespace Internal
} // namespace Nxt

#endif // NXTRESTTARGETRUNNER_H
