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

namespace nymea::api {

Param Param::fromJson(const QJsonObject &object) {
    Param value;
    if (object.contains(QStringLiteral("paramTypeId"))) {
        value.paramTypeId = QUuid((object.value(QStringLiteral("paramTypeId"))).toString());
    }
    if (object.contains(QStringLiteral("value"))) {
        value.value = object.value(QStringLiteral("value"));
    }
    return value;
}

QJsonObject Param::toJson() const {
    QJsonObject object;
    if (paramTypeId.has_value()) {
        object.insert(QStringLiteral("paramTypeId"), QJsonValue((*paramTypeId).toString()));
    }
    object.insert(QStringLiteral("value"), value);
    return object;
}

} // namespace nymea::api
