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

namespace nymea::api {

LogEntry LogEntry::fromJson(const QJsonObject &object) {
    LogEntry value;
    if (object.contains(QStringLiteral("source"))) {
        value.source = (object.value(QStringLiteral("source"))).toString();
    }
    if (object.contains(QStringLiteral("timestamp"))) {
        value.timestamp = jsonValueToUnsignedInteger(object.value(QStringLiteral("timestamp")));
    }
    if (object.contains(QStringLiteral("values"))) {
        value.values = (object.value(QStringLiteral("values"))).toObject();
    }
    return value;
}

QJsonObject LogEntry::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("source"), QJsonValue(source));
    object.insert(QStringLiteral("timestamp"), QJsonValue(static_cast<qint64>(timestamp)));
    object.insert(QStringLiteral("values"), QJsonValue(values));
    return object;
}

} // namespace nymea::api
