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

namespace nymea::api {

SerialPort SerialPort::fromJson(const QJsonObject &object) {
    SerialPort value;
    if (object.contains(QStringLiteral("description"))) {
        value.description = (object.value(QStringLiteral("description"))).toString();
    }
    if (object.contains(QStringLiteral("manufacturer"))) {
        value.manufacturer = (object.value(QStringLiteral("manufacturer"))).toString();
    }
    if (object.contains(QStringLiteral("serialNumber"))) {
        value.serialNumber = (object.value(QStringLiteral("serialNumber"))).toString();
    }
    if (object.contains(QStringLiteral("systemLocation"))) {
        value.systemLocation = (object.value(QStringLiteral("systemLocation"))).toString();
    }
    return value;
}

QJsonObject SerialPort::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("description"), QJsonValue(description));
    object.insert(QStringLiteral("manufacturer"), QJsonValue(manufacturer));
    object.insert(QStringLiteral("serialNumber"), QJsonValue(serialNumber));
    object.insert(QStringLiteral("systemLocation"), QJsonValue(systemLocation));
    return object;
}

} // namespace nymea::api
