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

namespace nymea::api {

Package Package::fromJson(const QJsonObject &object) {
    Package value;
    if (object.contains(QStringLiteral("canRemove"))) {
        value.canRemove = (object.value(QStringLiteral("canRemove"))).toBool();
    }
    if (object.contains(QStringLiteral("candidateVersion"))) {
        value.candidateVersion = (object.value(QStringLiteral("candidateVersion"))).toString();
    }
    if (object.contains(QStringLiteral("changelog"))) {
        value.changelog = (object.value(QStringLiteral("changelog"))).toString();
    }
    if (object.contains(QStringLiteral("displayName"))) {
        value.displayName = (object.value(QStringLiteral("displayName"))).toString();
    }
    if (object.contains(QStringLiteral("id"))) {
        value.id = (object.value(QStringLiteral("id"))).toString();
    }
    if (object.contains(QStringLiteral("installedVersion"))) {
        value.installedVersion = (object.value(QStringLiteral("installedVersion"))).toString();
    }
    if (object.contains(QStringLiteral("rollbackAvailable"))) {
        value.rollbackAvailable = (object.value(QStringLiteral("rollbackAvailable"))).toBool();
    }
    if (object.contains(QStringLiteral("summary"))) {
        value.summary = (object.value(QStringLiteral("summary"))).toString();
    }
    if (object.contains(QStringLiteral("updateAvailable"))) {
        value.updateAvailable = (object.value(QStringLiteral("updateAvailable"))).toBool();
    }
    return value;
}

QJsonObject Package::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("canRemove"), QJsonValue(canRemove));
    object.insert(QStringLiteral("candidateVersion"), QJsonValue(candidateVersion));
    object.insert(QStringLiteral("changelog"), QJsonValue(changelog));
    object.insert(QStringLiteral("displayName"), QJsonValue(displayName));
    object.insert(QStringLiteral("id"), QJsonValue(id));
    object.insert(QStringLiteral("installedVersion"), QJsonValue(installedVersion));
    object.insert(QStringLiteral("rollbackAvailable"), QJsonValue(rollbackAvailable));
    object.insert(QStringLiteral("summary"), QJsonValue(summary));
    object.insert(QStringLiteral("updateAvailable"), QJsonValue(updateAvailable));
    return object;
}

} // namespace nymea::api
