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

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

#include "DHHelpers.h"

namespace DeepinHomeAPI {

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

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

DHFeedback_CreateFeedbackRequest::~DHFeedback_CreateFeedbackRequest() {}

void DHFeedback_CreateFeedbackRequest::initializeModel() {

    m_content_isSet = false;
    m_content_isValid = false;

    m_email_isSet = false;
    m_email_isValid = false;

    m_language_isSet = false;
    m_language_isValid = false;

    m_screenshots_isSet = false;
    m_screenshots_isValid = false;

    m_system_info_isSet = false;
    m_system_info_isValid = false;

    m_title_isSet = false;
    m_title_isValid = false;

    m_type_isSet = false;
    m_type_isValid = false;

    m_version_isSet = false;
    m_version_isValid = false;
}

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

void DHFeedback_CreateFeedbackRequest::fromJsonObject(QJsonObject json) {

    m_content_isValid = ::DeepinHomeAPI::fromJsonValue(content, json[QString("content")]);
    m_content_isSet = !json[QString("content")].isNull() && m_content_isValid;

    m_email_isValid = ::DeepinHomeAPI::fromJsonValue(email, json[QString("email")]);
    m_email_isSet = !json[QString("email")].isNull() && m_email_isValid;

    m_language_isValid = ::DeepinHomeAPI::fromJsonValue(language, json[QString("language")]);
    m_language_isSet = !json[QString("language")].isNull() && m_language_isValid;

    m_screenshots_isValid = ::DeepinHomeAPI::fromJsonValue(screenshots, json[QString("screenshots")]);
    m_screenshots_isSet = !json[QString("screenshots")].isNull() && m_screenshots_isValid;

    m_system_info_isValid = ::DeepinHomeAPI::fromJsonValue(system_info, json[QString("system_info")]);
    m_system_info_isSet = !json[QString("system_info")].isNull() && m_system_info_isValid;

    m_title_isValid = ::DeepinHomeAPI::fromJsonValue(title, json[QString("title")]);
    m_title_isSet = !json[QString("title")].isNull() && m_title_isValid;

    m_type_isValid = ::DeepinHomeAPI::fromJsonValue(type, json[QString("type")]);
    m_type_isSet = !json[QString("type")].isNull() && m_type_isValid;

    m_version_isValid = ::DeepinHomeAPI::fromJsonValue(version, json[QString("version")]);
    m_version_isSet = !json[QString("version")].isNull() && m_version_isValid;
}

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

QJsonObject DHFeedback_CreateFeedbackRequest::asJsonObject() const {
    QJsonObject obj;
    if (m_content_isSet) {
        obj.insert(QString("content"), ::DeepinHomeAPI::toJsonValue(content));
    }
    if (m_email_isSet) {
        obj.insert(QString("email"), ::DeepinHomeAPI::toJsonValue(email));
    }
    if (m_language_isSet) {
        obj.insert(QString("language"), ::DeepinHomeAPI::toJsonValue(language));
    }
    if (screenshots.size() > 0) {
        obj.insert(QString("screenshots"), ::DeepinHomeAPI::toJsonValue(screenshots));
    }
    if (m_system_info_isSet) {
        obj.insert(QString("system_info"), ::DeepinHomeAPI::toJsonValue(system_info));
    }
    if (m_title_isSet) {
        obj.insert(QString("title"), ::DeepinHomeAPI::toJsonValue(title));
    }
    if (m_type_isSet) {
        obj.insert(QString("type"), ::DeepinHomeAPI::toJsonValue(type));
    }
    if (m_version_isSet) {
        obj.insert(QString("version"), ::DeepinHomeAPI::toJsonValue(version));
    }
    return obj;
}

QString DHFeedback_CreateFeedbackRequest::getContent() const {
    return content;
}
void DHFeedback_CreateFeedbackRequest::setContent(const QString &content) {
    this->content = content;
    this->m_content_isSet = true;
}

bool DHFeedback_CreateFeedbackRequest::is_content_Set() const{
    return m_content_isSet;
}

bool DHFeedback_CreateFeedbackRequest::is_content_Valid() const{
    return m_content_isValid;
}

QString DHFeedback_CreateFeedbackRequest::getEmail() const {
    return email;
}
void DHFeedback_CreateFeedbackRequest::setEmail(const QString &email) {
    this->email = email;
    this->m_email_isSet = true;
}

bool DHFeedback_CreateFeedbackRequest::is_email_Set() const{
    return m_email_isSet;
}

bool DHFeedback_CreateFeedbackRequest::is_email_Valid() const{
    return m_email_isValid;
}

QString DHFeedback_CreateFeedbackRequest::getLanguage() const {
    return language;
}
void DHFeedback_CreateFeedbackRequest::setLanguage(const QString &language) {
    this->language = language;
    this->m_language_isSet = true;
}

bool DHFeedback_CreateFeedbackRequest::is_language_Set() const{
    return m_language_isSet;
}

bool DHFeedback_CreateFeedbackRequest::is_language_Valid() const{
    return m_language_isValid;
}

QList<QString> DHFeedback_CreateFeedbackRequest::getScreenshots() const {
    return screenshots;
}
void DHFeedback_CreateFeedbackRequest::setScreenshots(const QList<QString> &screenshots) {
    this->screenshots = screenshots;
    this->m_screenshots_isSet = true;
}

bool DHFeedback_CreateFeedbackRequest::is_screenshots_Set() const{
    return m_screenshots_isSet;
}

bool DHFeedback_CreateFeedbackRequest::is_screenshots_Valid() const{
    return m_screenshots_isValid;
}

QString DHFeedback_CreateFeedbackRequest::getSystemInfo() const {
    return system_info;
}
void DHFeedback_CreateFeedbackRequest::setSystemInfo(const QString &system_info) {
    this->system_info = system_info;
    this->m_system_info_isSet = true;
}

bool DHFeedback_CreateFeedbackRequest::is_system_info_Set() const{
    return m_system_info_isSet;
}

bool DHFeedback_CreateFeedbackRequest::is_system_info_Valid() const{
    return m_system_info_isValid;
}

QString DHFeedback_CreateFeedbackRequest::getTitle() const {
    return title;
}
void DHFeedback_CreateFeedbackRequest::setTitle(const QString &title) {
    this->title = title;
    this->m_title_isSet = true;
}

bool DHFeedback_CreateFeedbackRequest::is_title_Set() const{
    return m_title_isSet;
}

bool DHFeedback_CreateFeedbackRequest::is_title_Valid() const{
    return m_title_isValid;
}

QString DHFeedback_CreateFeedbackRequest::getType() const {
    return type;
}
void DHFeedback_CreateFeedbackRequest::setType(const QString &type) {
    this->type = type;
    this->m_type_isSet = true;
}

bool DHFeedback_CreateFeedbackRequest::is_type_Set() const{
    return m_type_isSet;
}

bool DHFeedback_CreateFeedbackRequest::is_type_Valid() const{
    return m_type_isValid;
}

QString DHFeedback_CreateFeedbackRequest::getVersion() const {
    return version;
}
void DHFeedback_CreateFeedbackRequest::setVersion(const QString &version) {
    this->version = version;
    this->m_version_isSet = true;
}

bool DHFeedback_CreateFeedbackRequest::is_version_Set() const{
    return m_version_isSet;
}

bool DHFeedback_CreateFeedbackRequest::is_version_Valid() const{
    return m_version_isValid;
}

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

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

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

        if (screenshots.size() > 0) {
            isObjectUpdated = true;
            break;
        }

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

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

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

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

bool DHFeedback_CreateFeedbackRequest::isValid() const {
    // only required properties are required for the object to be considered valid
    return m_content_isValid && m_language_isValid && m_title_isValid && m_type_isValid && true;
}

} // namespace DeepinHomeAPI
