/**
 * linglong仓库
 * 玲珑仓库接口
 *
 * The version of the OpenAPI document: 1.0.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 "Response_SignIn.h"

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

#include "Helpers.h"

namespace linglong {
namespace api {
namespace client {

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

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

Response_SignIn::~Response_SignIn() {}

void Response_SignIn::initializeModel() {

    m_token_isSet = false;
    m_token_isValid = false;
}

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

void Response_SignIn::fromJsonObject(QJsonObject json) {

    m_token_isValid = ::linglong::api::client::fromJsonValue(m_token, json[QString("token")]);
    m_token_isSet = !json[QString("token")].isNull() && m_token_isValid;
}

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

QJsonObject Response_SignIn::asJsonObject() const {
    QJsonObject obj;
    if (m_token_isSet) {
        obj.insert(QString("token"), ::linglong::api::client::toJsonValue(m_token));
    }
    return obj;
}

QString Response_SignIn::getToken() const {
    return m_token;
}
void Response_SignIn::setToken(const QString &token) {
    m_token = token;
    m_token_isSet = true;
}

bool Response_SignIn::is_token_Set() const{
    return m_token_isSet;
}

bool Response_SignIn::is_token_Valid() const{
    return m_token_isValid;
}

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

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

} // namespace linglong
} // namespace api
} // namespace client
