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

namespace nymea::api {

BackupFile BackupFile::fromJson(const QJsonObject &object) {
    BackupFile value;
    if (object.contains(QStringLiteral("fileName"))) {
        value.fileName = (object.value(QStringLiteral("fileName"))).toString();
    }
    if (object.contains(QStringLiteral("serverVersion"))) {
        value.serverVersion = (object.value(QStringLiteral("serverVersion"))).toString();
    }
    if (object.contains(QStringLiteral("size"))) {
        value.size = (object.value(QStringLiteral("size"))).toDouble();
    }
    if (object.contains(QStringLiteral("timestamp"))) {
        value.timestamp = jsonValueToUnsignedInteger(object.value(QStringLiteral("timestamp")));
    }
    return value;
}

QJsonObject BackupFile::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("fileName"), QJsonValue(fileName));
    object.insert(QStringLiteral("serverVersion"), QJsonValue(serverVersion));
    object.insert(QStringLiteral("size"), QJsonValue(size));
    object.insert(QStringLiteral("timestamp"), QJsonValue(static_cast<qint64>(timestamp)));
    return object;
}

} // namespace nymea::api
