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

namespace nymea::api {

ScriptsScriptLogMessageNotificationParams ScriptsScriptLogMessageNotificationParams::fromJson(const QJsonObject &object) {
    ScriptsScriptLogMessageNotificationParams value;
    if (object.contains(QStringLiteral("message"))) {
        value.message = (object.value(QStringLiteral("message"))).toString();
    }
    if (object.contains(QStringLiteral("scriptId"))) {
        value.scriptId = QUuid((object.value(QStringLiteral("scriptId"))).toString());
    }
    if (object.contains(QStringLiteral("type"))) {
        value.type = parseScriptMessageType(object.value(QStringLiteral("type")));
    }
    return value;
}

QJsonObject ScriptsScriptLogMessageNotificationParams::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("message"), QJsonValue(message));
    object.insert(QStringLiteral("scriptId"), QJsonValue((scriptId).toString()));
    object.insert(QStringLiteral("type"), QJsonValue(toString(type)));
    return object;
}

} // namespace nymea::api
