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

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

#include "DHHelpers.h"

namespace DeepinHomeAPI {

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

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

DHHandlers_ClientUserInfoResponse::~DHHandlers_ClientUserInfoResponse() {}

void DHHandlers_ClientUserInfoResponse::initializeModel() {

    m_avatar_isSet = false;
    m_avatar_isValid = false;

    m_nickname_isSet = false;
    m_nickname_isValid = false;

    m_user_id_isSet = false;
    m_user_id_isValid = false;

    m_username_isSet = false;
    m_username_isValid = false;
}

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

void DHHandlers_ClientUserInfoResponse::fromJsonObject(QJsonObject json) {

    m_avatar_isValid = ::DeepinHomeAPI::fromJsonValue(avatar, json[QString("avatar")]);
    m_avatar_isSet = !json[QString("avatar")].isNull() && m_avatar_isValid;

    m_nickname_isValid = ::DeepinHomeAPI::fromJsonValue(nickname, json[QString("nickname")]);
    m_nickname_isSet = !json[QString("nickname")].isNull() && m_nickname_isValid;

    m_user_id_isValid = ::DeepinHomeAPI::fromJsonValue(user_id, json[QString("user_id")]);
    m_user_id_isSet = !json[QString("user_id")].isNull() && m_user_id_isValid;

    m_username_isValid = ::DeepinHomeAPI::fromJsonValue(username, json[QString("username")]);
    m_username_isSet = !json[QString("username")].isNull() && m_username_isValid;
}

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

QJsonObject DHHandlers_ClientUserInfoResponse::asJsonObject() const {
    QJsonObject obj;
    if (m_avatar_isSet) {
        obj.insert(QString("avatar"), ::DeepinHomeAPI::toJsonValue(avatar));
    }
    if (m_nickname_isSet) {
        obj.insert(QString("nickname"), ::DeepinHomeAPI::toJsonValue(nickname));
    }
    if (m_user_id_isSet) {
        obj.insert(QString("user_id"), ::DeepinHomeAPI::toJsonValue(user_id));
    }
    if (m_username_isSet) {
        obj.insert(QString("username"), ::DeepinHomeAPI::toJsonValue(username));
    }
    return obj;
}

QString DHHandlers_ClientUserInfoResponse::getAvatar() const {
    return avatar;
}
void DHHandlers_ClientUserInfoResponse::setAvatar(const QString &avatar) {
    this->avatar = avatar;
    this->m_avatar_isSet = true;
}

bool DHHandlers_ClientUserInfoResponse::is_avatar_Set() const{
    return m_avatar_isSet;
}

bool DHHandlers_ClientUserInfoResponse::is_avatar_Valid() const{
    return m_avatar_isValid;
}

QString DHHandlers_ClientUserInfoResponse::getNickname() const {
    return nickname;
}
void DHHandlers_ClientUserInfoResponse::setNickname(const QString &nickname) {
    this->nickname = nickname;
    this->m_nickname_isSet = true;
}

bool DHHandlers_ClientUserInfoResponse::is_nickname_Set() const{
    return m_nickname_isSet;
}

bool DHHandlers_ClientUserInfoResponse::is_nickname_Valid() const{
    return m_nickname_isValid;
}

QString DHHandlers_ClientUserInfoResponse::getUserId() const {
    return user_id;
}
void DHHandlers_ClientUserInfoResponse::setUserId(const QString &user_id) {
    this->user_id = user_id;
    this->m_user_id_isSet = true;
}

bool DHHandlers_ClientUserInfoResponse::is_user_id_Set() const{
    return m_user_id_isSet;
}

bool DHHandlers_ClientUserInfoResponse::is_user_id_Valid() const{
    return m_user_id_isValid;
}

QString DHHandlers_ClientUserInfoResponse::getUsername() const {
    return username;
}
void DHHandlers_ClientUserInfoResponse::setUsername(const QString &username) {
    this->username = username;
    this->m_username_isSet = true;
}

bool DHHandlers_ClientUserInfoResponse::is_username_Set() const{
    return m_username_isSet;
}

bool DHHandlers_ClientUserInfoResponse::is_username_Valid() const{
    return m_username_isValid;
}

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

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

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

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

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

} // namespace DeepinHomeAPI
