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

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

#include "DHHelpers.h"

namespace DeepinHomeAPI {

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

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

DHHandlers_LoginConfigResponse::~DHHandlers_LoginConfigResponse() {}

void DHHandlers_LoginConfigResponse::initializeModel() {

    m_client_id_isSet = false;
    m_client_id_isValid = false;

    m_redirect_url_isSet = false;
    m_redirect_url_isValid = false;

    m_scopes_isSet = false;
    m_scopes_isValid = false;
}

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

void DHHandlers_LoginConfigResponse::fromJsonObject(QJsonObject json) {

    m_client_id_isValid = ::DeepinHomeAPI::fromJsonValue(client_id, json[QString("client_id")]);
    m_client_id_isSet = !json[QString("client_id")].isNull() && m_client_id_isValid;

    m_redirect_url_isValid = ::DeepinHomeAPI::fromJsonValue(redirect_url, json[QString("redirect_url")]);
    m_redirect_url_isSet = !json[QString("redirect_url")].isNull() && m_redirect_url_isValid;

    m_scopes_isValid = ::DeepinHomeAPI::fromJsonValue(scopes, json[QString("scopes")]);
    m_scopes_isSet = !json[QString("scopes")].isNull() && m_scopes_isValid;
}

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

QJsonObject DHHandlers_LoginConfigResponse::asJsonObject() const {
    QJsonObject obj;
    if (m_client_id_isSet) {
        obj.insert(QString("client_id"), ::DeepinHomeAPI::toJsonValue(client_id));
    }
    if (m_redirect_url_isSet) {
        obj.insert(QString("redirect_url"), ::DeepinHomeAPI::toJsonValue(redirect_url));
    }
    if (scopes.size() > 0) {
        obj.insert(QString("scopes"), ::DeepinHomeAPI::toJsonValue(scopes));
    }
    return obj;
}

QString DHHandlers_LoginConfigResponse::getClientId() const {
    return client_id;
}
void DHHandlers_LoginConfigResponse::setClientId(const QString &client_id) {
    this->client_id = client_id;
    this->m_client_id_isSet = true;
}

bool DHHandlers_LoginConfigResponse::is_client_id_Set() const{
    return m_client_id_isSet;
}

bool DHHandlers_LoginConfigResponse::is_client_id_Valid() const{
    return m_client_id_isValid;
}

QString DHHandlers_LoginConfigResponse::getRedirectUrl() const {
    return redirect_url;
}
void DHHandlers_LoginConfigResponse::setRedirectUrl(const QString &redirect_url) {
    this->redirect_url = redirect_url;
    this->m_redirect_url_isSet = true;
}

bool DHHandlers_LoginConfigResponse::is_redirect_url_Set() const{
    return m_redirect_url_isSet;
}

bool DHHandlers_LoginConfigResponse::is_redirect_url_Valid() const{
    return m_redirect_url_isValid;
}

QList<QString> DHHandlers_LoginConfigResponse::getScopes() const {
    return scopes;
}
void DHHandlers_LoginConfigResponse::setScopes(const QList<QString> &scopes) {
    this->scopes = scopes;
    this->m_scopes_isSet = true;
}

bool DHHandlers_LoginConfigResponse::is_scopes_Set() const{
    return m_scopes_isSet;
}

bool DHHandlers_LoginConfigResponse::is_scopes_Valid() const{
    return m_scopes_isValid;
}

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

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

        if (scopes.size() > 0) {
            isObjectUpdated = true;
            break;
        }
    } while (false);
    return isObjectUpdated;
}

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

} // namespace DeepinHomeAPI
