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

namespace nymea::api {

WebServerConfiguration WebServerConfiguration::fromJson(const QJsonObject &object) {
    WebServerConfiguration value;
    if (object.contains(QStringLiteral("address"))) {
        value.address = (object.value(QStringLiteral("address"))).toString();
    }
    if (object.contains(QStringLiteral("authenticationEnabled"))) {
        value.authenticationEnabled = (object.value(QStringLiteral("authenticationEnabled"))).toBool();
    }
    if (object.contains(QStringLiteral("id"))) {
        value.id = (object.value(QStringLiteral("id"))).toString();
    }
    if (object.contains(QStringLiteral("port"))) {
        value.port = jsonValueToUnsignedInteger(object.value(QStringLiteral("port")));
    }
    if (object.contains(QStringLiteral("publicFolder"))) {
        value.publicFolder = (object.value(QStringLiteral("publicFolder"))).toString();
    }
    if (object.contains(QStringLiteral("sslEnabled"))) {
        value.sslEnabled = (object.value(QStringLiteral("sslEnabled"))).toBool();
    }
    return value;
}

QJsonObject WebServerConfiguration::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("address"), QJsonValue(address));
    object.insert(QStringLiteral("authenticationEnabled"), QJsonValue(authenticationEnabled));
    object.insert(QStringLiteral("id"), QJsonValue(id));
    object.insert(QStringLiteral("port"), QJsonValue(static_cast<qint64>(port)));
    object.insert(QStringLiteral("publicFolder"), QJsonValue(publicFolder));
    object.insert(QStringLiteral("sslEnabled"), QJsonValue(sslEnabled));
    return object;
}

} // namespace nymea::api
