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

namespace nymea::api {

IntegrationsGetThingClassesParams IntegrationsGetThingClassesParams::fromJson(const QJsonObject &object) {
    IntegrationsGetThingClassesParams value;
    if (object.contains(QStringLiteral("thingClassIds"))) {
        value.thingClassIds = ([&]() { QList<QUuid> list; for (const QJsonValue &item : (object.value(QStringLiteral("thingClassIds"))).toArray()) { list.append(QUuid((item).toString())); } return list; }());
    }
    if (object.contains(QStringLiteral("vendorId"))) {
        value.vendorId = QUuid((object.value(QStringLiteral("vendorId"))).toString());
    }
    return value;
}

QJsonObject IntegrationsGetThingClassesParams::toJson() const {
    QJsonObject object;
    if (thingClassIds.has_value()) {
        object.insert(QStringLiteral("thingClassIds"), ([&]() { QJsonArray array; for (const auto &item : *thingClassIds) { array.append(QJsonValue((item).toString())); } return QJsonValue(array); }()));
    }
    if (vendorId.has_value()) {
        object.insert(QStringLiteral("vendorId"), QJsonValue((*vendorId).toString()));
    }
    return object;
}

} // namespace nymea::api
