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

namespace nymea::api {

ModbusRtuAddModbusRtuMasterResponse ModbusRtuAddModbusRtuMasterResponse::fromJson(const QJsonObject &object) {
    ModbusRtuAddModbusRtuMasterResponse value;
    if (object.contains(QStringLiteral("modbusError"))) {
        value.modbusError = parseModbusRtuError(object.value(QStringLiteral("modbusError")));
    }
    if (object.contains(QStringLiteral("modbusUuid"))) {
        value.modbusUuid = QUuid((object.value(QStringLiteral("modbusUuid"))).toString());
    }
    return value;
}

QJsonObject ModbusRtuAddModbusRtuMasterResponse::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("modbusError"), QJsonValue(toString(modbusError)));
    if (modbusUuid.has_value()) {
        object.insert(QStringLiteral("modbusUuid"), QJsonValue((*modbusUuid).toString()));
    }
    return object;
}

} // namespace nymea::api
