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

namespace nymea::api {

JSONRPCCreateUserParams JSONRPCCreateUserParams::fromJson(const QJsonObject &object) {
    JSONRPCCreateUserParams value;
    if (object.contains(QStringLiteral("displayName"))) {
        value.displayName = (object.value(QStringLiteral("displayName"))).toString();
    }
    if (object.contains(QStringLiteral("email"))) {
        value.email = (object.value(QStringLiteral("email"))).toString();
    }
    if (object.contains(QStringLiteral("password"))) {
        value.password = (object.value(QStringLiteral("password"))).toString();
    }
    if (object.contains(QStringLiteral("username"))) {
        value.username = (object.value(QStringLiteral("username"))).toString();
    }
    return value;
}

QJsonObject JSONRPCCreateUserParams::toJson() const {
    QJsonObject object;
    if (displayName.has_value()) {
        object.insert(QStringLiteral("displayName"), QJsonValue(*displayName));
    }
    if (email.has_value()) {
        object.insert(QStringLiteral("email"), QJsonValue(*email));
    }
    object.insert(QStringLiteral("password"), QJsonValue(password));
    object.insert(QStringLiteral("username"), QJsonValue(username));
    return object;
}

} // namespace nymea::api
