// 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 "integrationsconfirmpairingparams.h"

namespace nymea::api {

IntegrationsConfirmPairingParams IntegrationsConfirmPairingParams::fromJson(const QJsonObject &object) {
    IntegrationsConfirmPairingParams value;
    if (object.contains(QStringLiteral("secret"))) {
        value.secret = (object.value(QStringLiteral("secret"))).toString();
    }
    if (object.contains(QStringLiteral("username"))) {
        value.username = (object.value(QStringLiteral("username"))).toString();
    }
    if (object.contains(QStringLiteral("pairingTransactionId"))) {
        value.pairingTransactionId = QUuid((object.value(QStringLiteral("pairingTransactionId"))).toString());
    }
    return value;
}

QJsonObject IntegrationsConfirmPairingParams::toJson() const {
    QJsonObject object;
    if (secret.has_value()) {
        object.insert(QStringLiteral("secret"), QJsonValue(*secret));
    }
    if (username.has_value()) {
        object.insert(QStringLiteral("username"), QJsonValue(*username));
    }
    object.insert(QStringLiteral("pairingTransactionId"), QJsonValue((pairingTransactionId).toString()));
    return object;
}

} // namespace nymea::api
