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

namespace nymea::api {

ZigbeeCluster ZigbeeCluster::fromJson(const QJsonObject &object) {
    ZigbeeCluster value;
    if (object.contains(QStringLiteral("clusterId"))) {
        value.clusterId = jsonValueToUnsignedInteger(object.value(QStringLiteral("clusterId")));
    }
    if (object.contains(QStringLiteral("direction"))) {
        value.direction = parseZigbeeClusterDirection(object.value(QStringLiteral("direction")));
    }
    return value;
}

QJsonObject ZigbeeCluster::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("clusterId"), QJsonValue(static_cast<qint64>(clusterId)));
    object.insert(QStringLiteral("direction"), QJsonValue(toString(direction)));
    return object;
}

} // namespace nymea::api
