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

namespace nymea::api {

UsersGetUserInfoResponse UsersGetUserInfoResponse::fromJson(const QJsonObject &object) {
    UsersGetUserInfoResponse value;
    if (object.contains(QStringLiteral("error"))) {
        value.error = parseUserError(object.value(QStringLiteral("error")));
    }
    if (object.contains(QStringLiteral("userInfo"))) {
        value.userInfo = UserInfo::fromJson((object.value(QStringLiteral("userInfo"))).toObject());
    }
    return value;
}

QJsonObject UsersGetUserInfoResponse::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("error"), QJsonValue(toString(error)));
    if (userInfo.has_value()) {
        object.insert(QStringLiteral("userInfo"), QJsonValue((*userInfo).toJson()));
    }
    return object;
}

} // namespace nymea::api
