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

namespace nymea::api {

WirelessAccessPoint WirelessAccessPoint::fromJson(const QJsonObject &object) {
    WirelessAccessPoint value;
    if (object.contains(QStringLiteral("frequency"))) {
        value.frequency = (object.value(QStringLiteral("frequency"))).toDouble();
    }
    if (object.contains(QStringLiteral("macAddress"))) {
        value.macAddress = (object.value(QStringLiteral("macAddress"))).toString();
    }
    if (object.contains(QStringLiteral("protected"))) {
        value.protectedValue = (object.value(QStringLiteral("protected"))).toBool();
    }
    if (object.contains(QStringLiteral("signalStrength"))) {
        value.signalStrength = jsonValueToInteger(object.value(QStringLiteral("signalStrength")));
    }
    if (object.contains(QStringLiteral("ssid"))) {
        value.ssid = (object.value(QStringLiteral("ssid"))).toString();
    }
    return value;
}

QJsonObject WirelessAccessPoint::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("frequency"), QJsonValue(frequency));
    object.insert(QStringLiteral("macAddress"), QJsonValue(macAddress));
    object.insert(QStringLiteral("protected"), QJsonValue(protectedValue));
    object.insert(QStringLiteral("signalStrength"), QJsonValue(static_cast<qint64>(signalStrength)));
    object.insert(QStringLiteral("ssid"), QJsonValue(ssid));
    return object;
}

} // namespace nymea::api
