#ifndef BACKEND_H
#define BACKEND_H

#include <QString>
#include <QJsonObject>
#include <functional>


class Backend {
public:
    Backend();

    void authWithPassword(
			QString &username,
			QString &password,
			std::function<void(QString, QString, QString)> callback
			);

    void authWithToken(std::function<void(QString, QString, QString)> callback);
    QString getStateFilePath();


private:
    void saveToJson(const QString &uuid, const QString &access_token);
    void sendPostRequest(const QString &url, const QJsonObject &payload, std::function<void(QJsonObject)> callback);
    QJsonObject loadFromJson();
};

#endif
