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

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

#include "Helpers.h"

namespace linglong {
namespace api {
namespace client {

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

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

Request_RegisterStruct::~Request_RegisterStruct() {}

void Request_RegisterStruct::initializeModel() {

    m_app_id_isSet = false;
    m_app_id_isValid = false;

    m_arch_isSet = false;
    m_arch_isValid = false;

    m_channel_isSet = false;
    m_channel_isValid = false;

    m_description_isSet = false;
    m_description_isValid = false;

    m_kind_isSet = false;
    m_kind_isValid = false;

    m_module_isSet = false;
    m_module_isValid = false;

    m_name_isSet = false;
    m_name_isValid = false;

    m_repo_name_isSet = false;
    m_repo_name_isValid = false;

    m_runtime_isSet = false;
    m_runtime_isValid = false;

    m_size_isSet = false;
    m_size_isValid = false;

    m_uab_url_isSet = false;
    m_uab_url_isValid = false;

    m_version_isSet = false;
    m_version_isValid = false;
}

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

void Request_RegisterStruct::fromJsonObject(QJsonObject json) {

    m_app_id_isValid = ::linglong::api::client::fromJsonValue(m_app_id, json[QString("appId")]);
    m_app_id_isSet = !json[QString("appId")].isNull() && m_app_id_isValid;

    m_arch_isValid = ::linglong::api::client::fromJsonValue(m_arch, json[QString("arch")]);
    m_arch_isSet = !json[QString("arch")].isNull() && m_arch_isValid;

    m_channel_isValid = ::linglong::api::client::fromJsonValue(m_channel, json[QString("channel")]);
    m_channel_isSet = !json[QString("channel")].isNull() && m_channel_isValid;

    m_description_isValid = ::linglong::api::client::fromJsonValue(m_description, json[QString("description")]);
    m_description_isSet = !json[QString("description")].isNull() && m_description_isValid;

    m_kind_isValid = ::linglong::api::client::fromJsonValue(m_kind, json[QString("kind")]);
    m_kind_isSet = !json[QString("kind")].isNull() && m_kind_isValid;

    m_module_isValid = ::linglong::api::client::fromJsonValue(m_module, json[QString("module")]);
    m_module_isSet = !json[QString("module")].isNull() && m_module_isValid;

    m_name_isValid = ::linglong::api::client::fromJsonValue(m_name, json[QString("name")]);
    m_name_isSet = !json[QString("name")].isNull() && m_name_isValid;

    m_repo_name_isValid = ::linglong::api::client::fromJsonValue(m_repo_name, json[QString("repoName")]);
    m_repo_name_isSet = !json[QString("repoName")].isNull() && m_repo_name_isValid;

    m_runtime_isValid = ::linglong::api::client::fromJsonValue(m_runtime, json[QString("runtime")]);
    m_runtime_isSet = !json[QString("runtime")].isNull() && m_runtime_isValid;

    m_size_isValid = ::linglong::api::client::fromJsonValue(m_size, json[QString("size")]);
    m_size_isSet = !json[QString("size")].isNull() && m_size_isValid;

    m_uab_url_isValid = ::linglong::api::client::fromJsonValue(m_uab_url, json[QString("uabUrl")]);
    m_uab_url_isSet = !json[QString("uabUrl")].isNull() && m_uab_url_isValid;

    m_version_isValid = ::linglong::api::client::fromJsonValue(m_version, json[QString("version")]);
    m_version_isSet = !json[QString("version")].isNull() && m_version_isValid;
}

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

QJsonObject Request_RegisterStruct::asJsonObject() const {
    QJsonObject obj;
    if (m_app_id_isSet) {
        obj.insert(QString("appId"), ::linglong::api::client::toJsonValue(m_app_id));
    }
    if (m_arch_isSet) {
        obj.insert(QString("arch"), ::linglong::api::client::toJsonValue(m_arch));
    }
    if (m_channel_isSet) {
        obj.insert(QString("channel"), ::linglong::api::client::toJsonValue(m_channel));
    }
    if (m_description_isSet) {
        obj.insert(QString("description"), ::linglong::api::client::toJsonValue(m_description));
    }
    if (m_kind_isSet) {
        obj.insert(QString("kind"), ::linglong::api::client::toJsonValue(m_kind));
    }
    if (m_module_isSet) {
        obj.insert(QString("module"), ::linglong::api::client::toJsonValue(m_module));
    }
    if (m_name_isSet) {
        obj.insert(QString("name"), ::linglong::api::client::toJsonValue(m_name));
    }
    if (m_repo_name_isSet) {
        obj.insert(QString("repoName"), ::linglong::api::client::toJsonValue(m_repo_name));
    }
    if (m_runtime_isSet) {
        obj.insert(QString("runtime"), ::linglong::api::client::toJsonValue(m_runtime));
    }
    if (m_size_isSet) {
        obj.insert(QString("size"), ::linglong::api::client::toJsonValue(m_size));
    }
    if (m_uab_url_isSet) {
        obj.insert(QString("uabUrl"), ::linglong::api::client::toJsonValue(m_uab_url));
    }
    if (m_version_isSet) {
        obj.insert(QString("version"), ::linglong::api::client::toJsonValue(m_version));
    }
    return obj;
}

QString Request_RegisterStruct::getAppId() const {
    return m_app_id;
}
void Request_RegisterStruct::setAppId(const QString &app_id) {
    m_app_id = app_id;
    m_app_id_isSet = true;
}

bool Request_RegisterStruct::is_app_id_Set() const{
    return m_app_id_isSet;
}

bool Request_RegisterStruct::is_app_id_Valid() const{
    return m_app_id_isValid;
}

QString Request_RegisterStruct::getArch() const {
    return m_arch;
}
void Request_RegisterStruct::setArch(const QString &arch) {
    m_arch = arch;
    m_arch_isSet = true;
}

bool Request_RegisterStruct::is_arch_Set() const{
    return m_arch_isSet;
}

bool Request_RegisterStruct::is_arch_Valid() const{
    return m_arch_isValid;
}

QString Request_RegisterStruct::getChannel() const {
    return m_channel;
}
void Request_RegisterStruct::setChannel(const QString &channel) {
    m_channel = channel;
    m_channel_isSet = true;
}

bool Request_RegisterStruct::is_channel_Set() const{
    return m_channel_isSet;
}

bool Request_RegisterStruct::is_channel_Valid() const{
    return m_channel_isValid;
}

QString Request_RegisterStruct::getDescription() const {
    return m_description;
}
void Request_RegisterStruct::setDescription(const QString &description) {
    m_description = description;
    m_description_isSet = true;
}

bool Request_RegisterStruct::is_description_Set() const{
    return m_description_isSet;
}

bool Request_RegisterStruct::is_description_Valid() const{
    return m_description_isValid;
}

QString Request_RegisterStruct::getKind() const {
    return m_kind;
}
void Request_RegisterStruct::setKind(const QString &kind) {
    m_kind = kind;
    m_kind_isSet = true;
}

bool Request_RegisterStruct::is_kind_Set() const{
    return m_kind_isSet;
}

bool Request_RegisterStruct::is_kind_Valid() const{
    return m_kind_isValid;
}

QString Request_RegisterStruct::getModule() const {
    return m_module;
}
void Request_RegisterStruct::setModule(const QString &module) {
    m_module = module;
    m_module_isSet = true;
}

bool Request_RegisterStruct::is_module_Set() const{
    return m_module_isSet;
}

bool Request_RegisterStruct::is_module_Valid() const{
    return m_module_isValid;
}

QString Request_RegisterStruct::getName() const {
    return m_name;
}
void Request_RegisterStruct::setName(const QString &name) {
    m_name = name;
    m_name_isSet = true;
}

bool Request_RegisterStruct::is_name_Set() const{
    return m_name_isSet;
}

bool Request_RegisterStruct::is_name_Valid() const{
    return m_name_isValid;
}

QString Request_RegisterStruct::getRepoName() const {
    return m_repo_name;
}
void Request_RegisterStruct::setRepoName(const QString &repo_name) {
    m_repo_name = repo_name;
    m_repo_name_isSet = true;
}

bool Request_RegisterStruct::is_repo_name_Set() const{
    return m_repo_name_isSet;
}

bool Request_RegisterStruct::is_repo_name_Valid() const{
    return m_repo_name_isValid;
}

QString Request_RegisterStruct::getRuntime() const {
    return m_runtime;
}
void Request_RegisterStruct::setRuntime(const QString &runtime) {
    m_runtime = runtime;
    m_runtime_isSet = true;
}

bool Request_RegisterStruct::is_runtime_Set() const{
    return m_runtime_isSet;
}

bool Request_RegisterStruct::is_runtime_Valid() const{
    return m_runtime_isValid;
}

qint32 Request_RegisterStruct::getSize() const {
    return m_size;
}
void Request_RegisterStruct::setSize(const qint32 &size) {
    m_size = size;
    m_size_isSet = true;
}

bool Request_RegisterStruct::is_size_Set() const{
    return m_size_isSet;
}

bool Request_RegisterStruct::is_size_Valid() const{
    return m_size_isValid;
}

QString Request_RegisterStruct::getUabUrl() const {
    return m_uab_url;
}
void Request_RegisterStruct::setUabUrl(const QString &uab_url) {
    m_uab_url = uab_url;
    m_uab_url_isSet = true;
}

bool Request_RegisterStruct::is_uab_url_Set() const{
    return m_uab_url_isSet;
}

bool Request_RegisterStruct::is_uab_url_Valid() const{
    return m_uab_url_isValid;
}

QString Request_RegisterStruct::getVersion() const {
    return m_version;
}
void Request_RegisterStruct::setVersion(const QString &version) {
    m_version = version;
    m_version_isSet = true;
}

bool Request_RegisterStruct::is_version_Set() const{
    return m_version_isSet;
}

bool Request_RegisterStruct::is_version_Valid() const{
    return m_version_isValid;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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