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

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

#include "Helpers.h"

namespace linglong {
namespace api {
namespace client {

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

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

Request_FuzzySearchReq::~Request_FuzzySearchReq() {}

void Request_FuzzySearchReq::initializeModel() {

    m_channel_isSet = false;
    m_channel_isValid = false;

    m_app_id_isSet = false;
    m_app_id_isValid = false;

    m_arch_isSet = false;
    m_arch_isValid = false;

    m_repo_name_isSet = false;
    m_repo_name_isValid = false;

    m_version_isSet = false;
    m_version_isValid = false;
}

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

void Request_FuzzySearchReq::fromJsonObject(QJsonObject json) {

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

    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_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_version_isValid = ::linglong::api::client::fromJsonValue(m_version, json[QString("version")]);
    m_version_isSet = !json[QString("version")].isNull() && m_version_isValid;
}

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

QJsonObject Request_FuzzySearchReq::asJsonObject() const {
    QJsonObject obj;
    if (m_channel_isSet) {
        obj.insert(QString("channel"), ::linglong::api::client::toJsonValue(m_channel));
    }
    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_repo_name_isSet) {
        obj.insert(QString("repoName"), ::linglong::api::client::toJsonValue(m_repo_name));
    }
    if (m_version_isSet) {
        obj.insert(QString("version"), ::linglong::api::client::toJsonValue(m_version));
    }
    return obj;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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