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

namespace nymea::api {

SystemGetTimeResponse SystemGetTimeResponse::fromJson(const QJsonObject &object) {
    SystemGetTimeResponse value;
    if (object.contains(QStringLiteral("automaticTime"))) {
        value.automaticTime = (object.value(QStringLiteral("automaticTime"))).toBool();
    }
    if (object.contains(QStringLiteral("automaticTimeAvailable"))) {
        value.automaticTimeAvailable = (object.value(QStringLiteral("automaticTimeAvailable"))).toBool();
    }
    if (object.contains(QStringLiteral("time"))) {
        value.time = jsonValueToUnsignedInteger(object.value(QStringLiteral("time")));
    }
    if (object.contains(QStringLiteral("timeZone"))) {
        value.timeZone = (object.value(QStringLiteral("timeZone"))).toString();
    }
    return value;
}

QJsonObject SystemGetTimeResponse::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("automaticTime"), QJsonValue(automaticTime));
    object.insert(QStringLiteral("automaticTimeAvailable"), QJsonValue(automaticTimeAvailable));
    object.insert(QStringLiteral("time"), QJsonValue(static_cast<qint64>(time)));
    object.insert(QStringLiteral("timeZone"), QJsonValue(timeZone));
    return object;
}

} // namespace nymea::api
