// SPDX-License-Identifier: GPL-3.0-or-later

// This file is auto-generated by scripts/generate_nymea_api.py
// Any changes made here will be lost when the files are regenerated.
// Do not edit manually.

#include "userspushbuttonauthfinishednotificationparams.h"

namespace nymea::api {

UsersPushButtonAuthFinishedNotificationParams UsersPushButtonAuthFinishedNotificationParams::fromJson(const QJsonObject &object) {
    UsersPushButtonAuthFinishedNotificationParams value;
    if (object.contains(QStringLiteral("token"))) {
        value.token = (object.value(QStringLiteral("token"))).toString();
    }
    if (object.contains(QStringLiteral("success"))) {
        value.success = (object.value(QStringLiteral("success"))).toBool();
    }
    if (object.contains(QStringLiteral("transactionId"))) {
        value.transactionId = jsonValueToInteger(object.value(QStringLiteral("transactionId")));
    }
    return value;
}

QJsonObject UsersPushButtonAuthFinishedNotificationParams::toJson() const {
    QJsonObject object;
    if (token.has_value()) {
        object.insert(QStringLiteral("token"), QJsonValue(*token));
    }
    object.insert(QStringLiteral("success"), QJsonValue(success));
    object.insert(QStringLiteral("transactionId"), QJsonValue(static_cast<qint64>(transactionId)));
    return object;
}

} // namespace nymea::api
