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

namespace nymea::api {

ScriptsGetScriptContentResponse ScriptsGetScriptContentResponse::fromJson(const QJsonObject &object) {
    ScriptsGetScriptContentResponse value;
    if (object.contains(QStringLiteral("content"))) {
        value.content = (object.value(QStringLiteral("content"))).toString();
    }
    if (object.contains(QStringLiteral("scriptError"))) {
        value.scriptError = parseScriptError(object.value(QStringLiteral("scriptError")));
    }
    return value;
}

QJsonObject ScriptsGetScriptContentResponse::toJson() const {
    QJsonObject object;
    if (content.has_value()) {
        object.insert(QStringLiteral("content"), QJsonValue(*content));
    }
    object.insert(QStringLiteral("scriptError"), QJsonValue(toString(scriptError)));
    return object;
}

} // namespace nymea::api
