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

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

#include "DHHelpers.h"

namespace DeepinHomeAPI {

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

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

DHHandlers_ClientLoginRequest::~DHHandlers_ClientLoginRequest() {}

void DHHandlers_ClientLoginRequest::initializeModel() {

    m_code_isSet = false;
    m_code_isValid = false;
}

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

void DHHandlers_ClientLoginRequest::fromJsonObject(QJsonObject json) {

    m_code_isValid = ::DeepinHomeAPI::fromJsonValue(code, json[QString("code")]);
    m_code_isSet = !json[QString("code")].isNull() && m_code_isValid;
}

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

QJsonObject DHHandlers_ClientLoginRequest::asJsonObject() const {
    QJsonObject obj;
    if (m_code_isSet) {
        obj.insert(QString("code"), ::DeepinHomeAPI::toJsonValue(code));
    }
    return obj;
}

QString DHHandlers_ClientLoginRequest::getCode() const {
    return code;
}
void DHHandlers_ClientLoginRequest::setCode(const QString &code) {
    this->code = code;
    this->m_code_isSet = true;
}

bool DHHandlers_ClientLoginRequest::is_code_Set() const{
    return m_code_isSet;
}

bool DHHandlers_ClientLoginRequest::is_code_Valid() const{
    return m_code_isValid;
}

bool DHHandlers_ClientLoginRequest::isSet() const {
    bool isObjectUpdated = false;
    do {
        if (m_code_isSet) {
            isObjectUpdated = true;
            break;
        }
    } while (false);
    return isObjectUpdated;
}

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

} // namespace DeepinHomeAPI
