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

namespace nymea::api {

ConfigurationBasicConfigurationChangedNotificationParamsBasicConfiguration ConfigurationBasicConfigurationChangedNotificationParamsBasicConfiguration::fromJson(const QJsonObject &object) {
    ConfigurationBasicConfigurationChangedNotificationParamsBasicConfiguration value;
    if (object.contains(QStringLiteral("language"))) {
        value.language = (object.value(QStringLiteral("language"))).toString();
    }
    if (object.contains(QStringLiteral("location"))) {
        value.location = ConfigurationBasicConfigurationChangedNotificationParamsBasicConfigurationLocation::fromJson((object.value(QStringLiteral("location"))).toObject());
    }
    if (object.contains(QStringLiteral("serverTime"))) {
        value.serverTime = jsonValueToUnsignedInteger(object.value(QStringLiteral("serverTime")));
    }
    if (object.contains(QStringLiteral("timeZone"))) {
        value.timeZone = (object.value(QStringLiteral("timeZone"))).toString();
    }
    if (object.contains(QStringLiteral("debugServerEnabled"))) {
        value.debugServerEnabled = (object.value(QStringLiteral("debugServerEnabled"))).toBool();
    }
    if (object.contains(QStringLiteral("serverName"))) {
        value.serverName = (object.value(QStringLiteral("serverName"))).toString();
    }
    if (object.contains(QStringLiteral("serverUuid"))) {
        value.serverUuid = QUuid((object.value(QStringLiteral("serverUuid"))).toString());
    }
    return value;
}

QJsonObject ConfigurationBasicConfigurationChangedNotificationParamsBasicConfiguration::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("language"), QJsonValue(language));
    object.insert(QStringLiteral("location"), QJsonValue((location).toJson()));
    object.insert(QStringLiteral("serverTime"), QJsonValue(static_cast<qint64>(serverTime)));
    object.insert(QStringLiteral("timeZone"), QJsonValue(timeZone));
    object.insert(QStringLiteral("debugServerEnabled"), QJsonValue(debugServerEnabled));
    object.insert(QStringLiteral("serverName"), QJsonValue(serverName));
    object.insert(QStringLiteral("serverUuid"), QJsonValue((serverUuid).toString()));
    return object;
}

} // namespace nymea::api
