#ifndef REPORTISSUEDIALOG_H
#define REPORTISSUEDIALOG_H

#include <QDialog>
#include <QNetworkAccessManager>
#include <QNetworkReply>

namespace Ui {
class ReportIssueDialog;
}

class ReportIssueDialog : public QDialog
{
    Q_OBJECT

public:
    explicit ReportIssueDialog(const QString &giteaBaseUrl,
                               const QString &repoOwner,
                               const QString &repoName,
                               const QString &accessToken,
                               QWidget *parent = nullptr);
    ~ReportIssueDialog();

private slots:
    void on_buttonSend_clicked();
    void on_buttonCancel_clicked();

    void onNetworkReplyFinished(QNetworkReply *reply);

private:
    Ui::ReportIssueDialog *ui;

    QNetworkAccessManager *networkManager;

    QString giteaBaseUrl;
    QString repoOwner;
    QString repoName;
    QString accessToken;

    void sendIssueReport(const QString &title, const QString &body, const QString &contact);
};

#endif // REPORTISSUEDIALOG_H
