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

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

#include "DHHelpers.h"

namespace DeepinHomeAPI {

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

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

DHFeedback_PublicViewResponse::~DHFeedback_PublicViewResponse() {}

void DHFeedback_PublicViewResponse::initializeModel() {

    m_public_id_isSet = false;
    m_public_id_isValid = false;

    m_view_count_isSet = false;
    m_view_count_isValid = false;
}

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

void DHFeedback_PublicViewResponse::fromJsonObject(QJsonObject json) {

    m_public_id_isValid = ::DeepinHomeAPI::fromJsonValue(public_id, json[QString("public_id")]);
    m_public_id_isSet = !json[QString("public_id")].isNull() && m_public_id_isValid;

    m_view_count_isValid = ::DeepinHomeAPI::fromJsonValue(view_count, json[QString("view_count")]);
    m_view_count_isSet = !json[QString("view_count")].isNull() && m_view_count_isValid;
}

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

QJsonObject DHFeedback_PublicViewResponse::asJsonObject() const {
    QJsonObject obj;
    if (m_public_id_isSet) {
        obj.insert(QString("public_id"), ::DeepinHomeAPI::toJsonValue(public_id));
    }
    if (m_view_count_isSet) {
        obj.insert(QString("view_count"), ::DeepinHomeAPI::toJsonValue(view_count));
    }
    return obj;
}

QString DHFeedback_PublicViewResponse::getPublicId() const {
    return public_id;
}
void DHFeedback_PublicViewResponse::setPublicId(const QString &public_id) {
    this->public_id = public_id;
    this->m_public_id_isSet = true;
}

bool DHFeedback_PublicViewResponse::is_public_id_Set() const{
    return m_public_id_isSet;
}

bool DHFeedback_PublicViewResponse::is_public_id_Valid() const{
    return m_public_id_isValid;
}

qint32 DHFeedback_PublicViewResponse::getViewCount() const {
    return view_count;
}
void DHFeedback_PublicViewResponse::setViewCount(const qint32 &view_count) {
    this->view_count = view_count;
    this->m_view_count_isSet = true;
}

bool DHFeedback_PublicViewResponse::is_view_count_Set() const{
    return m_view_count_isSet;
}

bool DHFeedback_PublicViewResponse::is_view_count_Valid() const{
    return m_view_count_isValid;
}

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

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

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

} // namespace DeepinHomeAPI
