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

namespace nymea::api {

NetworkManagerGetNetworkStatusResponseStatus NetworkManagerGetNetworkStatusResponseStatus::fromJson(const QJsonObject &object) {
    NetworkManagerGetNetworkStatusResponseStatus value;
    if (object.contains(QStringLiteral("networkingEnabled"))) {
        value.networkingEnabled = (object.value(QStringLiteral("networkingEnabled"))).toBool();
    }
    if (object.contains(QStringLiteral("state"))) {
        value.state = parseNetworkManagerState(object.value(QStringLiteral("state")));
    }
    if (object.contains(QStringLiteral("wirelessNetworkingEnabled"))) {
        value.wirelessNetworkingEnabled = (object.value(QStringLiteral("wirelessNetworkingEnabled"))).toBool();
    }
    return value;
}

QJsonObject NetworkManagerGetNetworkStatusResponseStatus::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("networkingEnabled"), QJsonValue(networkingEnabled));
    object.insert(QStringLiteral("state"), QJsonValue(toString(state)));
    object.insert(QStringLiteral("wirelessNetworkingEnabled"), QJsonValue(wirelessNetworkingEnabled));
    return object;
}

} // namespace nymea::api
