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

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

#include "DHHelpers.h"

namespace DeepinHomeAPI {

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

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

DHHandlers_PreUploadResponse::~DHHandlers_PreUploadResponse() {}

void DHHandlers_PreUploadResponse::initializeModel() {

    m_form_data_isSet = false;
    m_form_data_isValid = false;

    m_id_isSet = false;
    m_id_isValid = false;

    m_url_isSet = false;
    m_url_isValid = false;
}

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

void DHHandlers_PreUploadResponse::fromJsonObject(QJsonObject json) {

    m_form_data_isValid = ::DeepinHomeAPI::fromJsonValue(form_data, json[QString("form_data")]);
    m_form_data_isSet = !json[QString("form_data")].isNull() && m_form_data_isValid;

    m_id_isValid = ::DeepinHomeAPI::fromJsonValue(id, json[QString("id")]);
    m_id_isSet = !json[QString("id")].isNull() && m_id_isValid;

    m_url_isValid = ::DeepinHomeAPI::fromJsonValue(url, json[QString("url")]);
    m_url_isSet = !json[QString("url")].isNull() && m_url_isValid;
}

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

QJsonObject DHHandlers_PreUploadResponse::asJsonObject() const {
    QJsonObject obj;
    if (form_data.size() > 0) {
        obj.insert(QString("form_data"), ::DeepinHomeAPI::toJsonValue(form_data));
    }
    if (m_id_isSet) {
        obj.insert(QString("id"), ::DeepinHomeAPI::toJsonValue(id));
    }
    if (m_url_isSet) {
        obj.insert(QString("url"), ::DeepinHomeAPI::toJsonValue(url));
    }
    return obj;
}

QMap<QString, QString> DHHandlers_PreUploadResponse::getFormData() const {
    return form_data;
}
void DHHandlers_PreUploadResponse::setFormData(const QMap<QString, QString> &form_data) {
    this->form_data = form_data;
    this->m_form_data_isSet = true;
}

bool DHHandlers_PreUploadResponse::is_form_data_Set() const{
    return m_form_data_isSet;
}

bool DHHandlers_PreUploadResponse::is_form_data_Valid() const{
    return m_form_data_isValid;
}

QString DHHandlers_PreUploadResponse::getId() const {
    return id;
}
void DHHandlers_PreUploadResponse::setId(const QString &id) {
    this->id = id;
    this->m_id_isSet = true;
}

bool DHHandlers_PreUploadResponse::is_id_Set() const{
    return m_id_isSet;
}

bool DHHandlers_PreUploadResponse::is_id_Valid() const{
    return m_id_isValid;
}

QString DHHandlers_PreUploadResponse::getUrl() const {
    return url;
}
void DHHandlers_PreUploadResponse::setUrl(const QString &url) {
    this->url = url;
    this->m_url_isSet = true;
}

bool DHHandlers_PreUploadResponse::is_url_Set() const{
    return m_url_isSet;
}

bool DHHandlers_PreUploadResponse::is_url_Valid() const{
    return m_url_isValid;
}

bool DHHandlers_PreUploadResponse::isSet() const {
    bool isObjectUpdated = false;
    do {
        if (form_data.size() > 0) {
            isObjectUpdated = true;
            break;
        }

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

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

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

} // namespace DeepinHomeAPI
