/**
 * Nsmf_PDUSession
 * SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. 
 *
 * The version of the OpenAPI document: 1.1.0.alpha-1
 *
 * NOTE: This class is auto generated by OpenAPI-Generator 4.1.1-SNAPSHOT.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */



#include "InvalidParam_2.h"

namespace oai {
namespace smf {
namespace model {




InvalidParam_2::InvalidParam_2()
{
    m_Param = utility::conversions::to_string_t("");
    m_Reason = utility::conversions::to_string_t("");
    m_ReasonIsSet = false;
}

InvalidParam_2::~InvalidParam_2()
{
}

void InvalidParam_2::validate()
{
    // TODO: implement validation
}

web::json::value InvalidParam_2::toJson() const
{
    web::json::value val = web::json::value::object();

    val[utility::conversions::to_string_t("param")] = ModelBase::toJson(m_Param);
    if(m_ReasonIsSet)
    {
        val[utility::conversions::to_string_t("reason")] = ModelBase::toJson(m_Reason);
    }

    return val;
}

void InvalidParam_2::fromJson(const web::json::value& val)
{
    setParam(ModelBase::stringFromJson(val.at(utility::conversions::to_string_t("param"))));
    if(val.has_field(utility::conversions::to_string_t("reason")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("reason"));
        if(!fieldValue.is_null())
        {
            setReason(ModelBase::stringFromJson(fieldValue));
        }
    }
}

void InvalidParam_2::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
{
    utility::string_t namePrefix = prefix;
    if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
    {
        namePrefix += utility::conversions::to_string_t(".");
    }

    multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("param"), m_Param));
    if(m_ReasonIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("reason"), m_Reason));
    }
}

void InvalidParam_2::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix)
{
    utility::string_t namePrefix = prefix;
    if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
    {
        namePrefix += utility::conversions::to_string_t(".");
    }

    setParam(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("param"))));
    if(multipart->hasContent(utility::conversions::to_string_t("reason")))
    {
        setReason(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("reason"))));
    }
}

utility::string_t InvalidParam_2::getParam() const
{
    return m_Param;
}

void InvalidParam_2::setParam(const utility::string_t& value)
{
    m_Param = value;
    
}

utility::string_t InvalidParam_2::getReason() const
{
    return m_Reason;
}

void InvalidParam_2::setReason(const utility::string_t& value)
{
    m_Reason = value;
    m_ReasonIsSet = true;
}

bool InvalidParam_2::reasonIsSet() const
{
    return m_ReasonIsSet;
}

void InvalidParam_2::unsetReason()
{
    m_ReasonIsSet = false;
}

}
}
}


