/**
 * Deepin官网
 * deepin的官方网站后台接口
 *
 * The version of the OpenAPI document: 1.0
 * Contact: wurongjie@deepin.org
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

#include "DHHandlers_Topic.h"

#include <QDebug>
#include <QJsonArray>
#include <QJsonDocument>
#include <QObject>

#include "DHHelpers.h"

namespace DeepinHomeAPI {

DHHandlers_Topic::DHHandlers_Topic(QString json) {
    this->initializeModel();
    this->fromJson(json);
}

DHHandlers_Topic::DHHandlers_Topic() {
    this->initializeModel();
}

DHHandlers_Topic::~DHHandlers_Topic() {}

void DHHandlers_Topic::initializeModel() {

    m_change_id_isSet = false;
    m_change_id_isValid = false;

    m_name_isSet = false;
    m_name_isValid = false;

    m_notify_isSet = false;
    m_notify_isValid = false;
}

void DHHandlers_Topic::fromJson(QString jsonString) {
    QByteArray array(jsonString.toStdString().c_str());
    QJsonDocument doc = QJsonDocument::fromJson(array);
    QJsonObject jsonObject = doc.object();
    this->fromJsonObject(jsonObject);
}

void DHHandlers_Topic::fromJsonObject(QJsonObject json) {

    m_change_id_isValid = ::DeepinHomeAPI::fromJsonValue(change_id, json[QString("change_id")]);
    m_change_id_isSet = !json[QString("change_id")].isNull() && m_change_id_isValid;

    m_name_isValid = ::DeepinHomeAPI::fromJsonValue(name, json[QString("name")]);
    m_name_isSet = !json[QString("name")].isNull() && m_name_isValid;

    m_notify_isValid = ::DeepinHomeAPI::fromJsonValue(notify, json[QString("notify")]);
    m_notify_isSet = !json[QString("notify")].isNull() && m_notify_isValid;
}

QString DHHandlers_Topic::asJson() const {
    QJsonObject obj = this->asJsonObject();
    QJsonDocument doc(obj);
    QByteArray bytes = doc.toJson();
    return QString(bytes);
}

QJsonObject DHHandlers_Topic::asJsonObject() const {
    QJsonObject obj;
    if (m_change_id_isSet) {
        obj.insert(QString("change_id"), ::DeepinHomeAPI::toJsonValue(change_id));
    }
    if (m_name_isSet) {
        obj.insert(QString("name"), ::DeepinHomeAPI::toJsonValue(name));
    }
    if (m_notify_isSet) {
        obj.insert(QString("notify"), ::DeepinHomeAPI::toJsonValue(notify));
    }
    return obj;
}

QString DHHandlers_Topic::getChangeId() const {
    return change_id;
}
void DHHandlers_Topic::setChangeId(const QString &change_id) {
    this->change_id = change_id;
    this->m_change_id_isSet = true;
}

bool DHHandlers_Topic::is_change_id_Set() const{
    return m_change_id_isSet;
}

bool DHHandlers_Topic::is_change_id_Valid() const{
    return m_change_id_isValid;
}

QString DHHandlers_Topic::getName() const {
    return name;
}
void DHHandlers_Topic::setName(const QString &name) {
    this->name = name;
    this->m_name_isSet = true;
}

bool DHHandlers_Topic::is_name_Set() const{
    return m_name_isSet;
}

bool DHHandlers_Topic::is_name_Valid() const{
    return m_name_isValid;
}

bool DHHandlers_Topic::isNotify() const {
    return notify;
}
void DHHandlers_Topic::setNotify(const bool &notify) {
    this->notify = notify;
    this->m_notify_isSet = true;
}

bool DHHandlers_Topic::is_notify_Set() const{
    return m_notify_isSet;
}

bool DHHandlers_Topic::is_notify_Valid() const{
    return m_notify_isValid;
}

bool DHHandlers_Topic::isSet() const {
    bool isObjectUpdated = false;
    do {
        if (m_change_id_isSet) {
            isObjectUpdated = true;
            break;
        }

        if (m_name_isSet) {
            isObjectUpdated = true;
            break;
        }

        if (m_notify_isSet) {
            isObjectUpdated = true;
            break;
        }
    } while (false);
    return isObjectUpdated;
}

bool DHHandlers_Topic::isValid() const {
    // only required properties are required for the object to be considered valid
    return true;
}

} // namespace DeepinHomeAPI
