/**
 * Swaggy Jenkins
 * Jenkins API clients generated from Swagger / Open API specification
 *
 * The version of the OpenAPI document: 1.1.2-pre.0
 * Contact: blah@cliffano.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

#include "OAIStringParameterDefinition.h"

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

#include "OAIHelpers.h"

namespace OpenAPI {

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

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

OAIStringParameterDefinition::~OAIStringParameterDefinition() {}

void OAIStringParameterDefinition::initializeModel() {

    m__class_isSet = false;
    m__class_isValid = false;

    m_default_parameter_value_isSet = false;
    m_default_parameter_value_isValid = false;

    m_description_isSet = false;
    m_description_isValid = false;

    m_name_isSet = false;
    m_name_isValid = false;

    m_type_isSet = false;
    m_type_isValid = false;
}

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

void OAIStringParameterDefinition::fromJsonObject(QJsonObject json) {

    m__class_isValid = ::OpenAPI::fromJsonValue(_class, json[QString("_class")]);
    m__class_isSet = !json[QString("_class")].isNull() && m__class_isValid;

    m_default_parameter_value_isValid = ::OpenAPI::fromJsonValue(default_parameter_value, json[QString("defaultParameterValue")]);
    m_default_parameter_value_isSet = !json[QString("defaultParameterValue")].isNull() && m_default_parameter_value_isValid;

    m_description_isValid = ::OpenAPI::fromJsonValue(description, json[QString("description")]);
    m_description_isSet = !json[QString("description")].isNull() && m_description_isValid;

    m_name_isValid = ::OpenAPI::fromJsonValue(name, json[QString("name")]);
    m_name_isSet = !json[QString("name")].isNull() && m_name_isValid;

    m_type_isValid = ::OpenAPI::fromJsonValue(type, json[QString("type")]);
    m_type_isSet = !json[QString("type")].isNull() && m_type_isValid;
}

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

QJsonObject OAIStringParameterDefinition::asJsonObject() const {
    QJsonObject obj;
    if (m__class_isSet) {
        obj.insert(QString("_class"), ::OpenAPI::toJsonValue(_class));
    }
    if (default_parameter_value.isSet()) {
        obj.insert(QString("defaultParameterValue"), ::OpenAPI::toJsonValue(default_parameter_value));
    }
    if (m_description_isSet) {
        obj.insert(QString("description"), ::OpenAPI::toJsonValue(description));
    }
    if (m_name_isSet) {
        obj.insert(QString("name"), ::OpenAPI::toJsonValue(name));
    }
    if (m_type_isSet) {
        obj.insert(QString("type"), ::OpenAPI::toJsonValue(type));
    }
    return obj;
}

QString OAIStringParameterDefinition::getClass() const {
    return _class;
}
void OAIStringParameterDefinition::setClass(const QString &_class) {
    this->_class = _class;
    this->m__class_isSet = true;
}

bool OAIStringParameterDefinition::is__class_Set() const{
    return m__class_isSet;
}

bool OAIStringParameterDefinition::is__class_Valid() const{
    return m__class_isValid;
}

OAIStringParameterValue OAIStringParameterDefinition::getDefaultParameterValue() const {
    return default_parameter_value;
}
void OAIStringParameterDefinition::setDefaultParameterValue(const OAIStringParameterValue &default_parameter_value) {
    this->default_parameter_value = default_parameter_value;
    this->m_default_parameter_value_isSet = true;
}

bool OAIStringParameterDefinition::is_default_parameter_value_Set() const{
    return m_default_parameter_value_isSet;
}

bool OAIStringParameterDefinition::is_default_parameter_value_Valid() const{
    return m_default_parameter_value_isValid;
}

QString OAIStringParameterDefinition::getDescription() const {
    return description;
}
void OAIStringParameterDefinition::setDescription(const QString &description) {
    this->description = description;
    this->m_description_isSet = true;
}

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

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

QString OAIStringParameterDefinition::getName() const {
    return name;
}
void OAIStringParameterDefinition::setName(const QString &name) {
    this->name = name;
    this->m_name_isSet = true;
}

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

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

QString OAIStringParameterDefinition::getType() const {
    return type;
}
void OAIStringParameterDefinition::setType(const QString &type) {
    this->type = type;
    this->m_type_isSet = true;
}

bool OAIStringParameterDefinition::is_type_Set() const{
    return m_type_isSet;
}

bool OAIStringParameterDefinition::is_type_Valid() const{
    return m_type_isValid;
}

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

        if (default_parameter_value.isSet()) {
            isObjectUpdated = true;
            break;
        }

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

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

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

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

} // namespace OpenAPI
