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

namespace nymea::api {

RuleDescription RuleDescription::fromJson(const QJsonObject &object) {
    RuleDescription value;
    if (object.contains(QStringLiteral("active"))) {
        value.active = (object.value(QStringLiteral("active"))).toBool();
    }
    if (object.contains(QStringLiteral("enabled"))) {
        value.enabled = (object.value(QStringLiteral("enabled"))).toBool();
    }
    if (object.contains(QStringLiteral("executable"))) {
        value.executable = (object.value(QStringLiteral("executable"))).toBool();
    }
    if (object.contains(QStringLiteral("id"))) {
        value.id = QUuid((object.value(QStringLiteral("id"))).toString());
    }
    if (object.contains(QStringLiteral("name"))) {
        value.name = (object.value(QStringLiteral("name"))).toString();
    }
    return value;
}

QJsonObject RuleDescription::toJson() const {
    QJsonObject object;
    object.insert(QStringLiteral("active"), QJsonValue(active));
    object.insert(QStringLiteral("enabled"), QJsonValue(enabled));
    object.insert(QStringLiteral("executable"), QJsonValue(executable));
    object.insert(QStringLiteral("id"), QJsonValue((id).toString()));
    object.insert(QStringLiteral("name"), QJsonValue(name));
    return object;
}

} // namespace nymea::api
