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

namespace oai {
namespace smf {
namespace model {




SmContextReleaseData::SmContextReleaseData()
{
    m_CauseIsSet = false;
    m_NgApCauseIsSet = false;
    m__5gMmCauseValue = 0;
    m__5gMmCauseValueIsSet = false;
    m_UeLocationIsSet = false;
    m_UeTimeZone = utility::conversions::to_string_t("");
    m_UeTimeZoneIsSet = false;
    m_AddUeLocationIsSet = false;
    m_VsmfReleaseOnly = false;
    m_VsmfReleaseOnlyIsSet = false;
    m_N2SmInfoIsSet = false;
    m_N2SmInfoTypeIsSet = false;
    m_IsmfReleaseOnly = false;
    m_IsmfReleaseOnlyIsSet = false;
}

SmContextReleaseData::~SmContextReleaseData()
{
}

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

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

    if(m_CauseIsSet)
    {
        val[utility::conversions::to_string_t("cause")] = ModelBase::toJson(m_Cause);
    }
    if(m_NgApCauseIsSet)
    {
        val[utility::conversions::to_string_t("ngApCause")] = ModelBase::toJson(m_NgApCause);
    }
    if(m__5gMmCauseValueIsSet)
    {
        val[utility::conversions::to_string_t("5gMmCauseValue")] = ModelBase::toJson(m__5gMmCauseValue);
    }
    if(m_UeLocationIsSet)
    {
        val[utility::conversions::to_string_t("ueLocation")] = ModelBase::toJson(m_UeLocation);
    }
    if(m_UeTimeZoneIsSet)
    {
        val[utility::conversions::to_string_t("ueTimeZone")] = ModelBase::toJson(m_UeTimeZone);
    }
    if(m_AddUeLocationIsSet)
    {
        val[utility::conversions::to_string_t("addUeLocation")] = ModelBase::toJson(m_AddUeLocation);
    }
    if(m_VsmfReleaseOnlyIsSet)
    {
        val[utility::conversions::to_string_t("vsmfReleaseOnly")] = ModelBase::toJson(m_VsmfReleaseOnly);
    }
    if(m_N2SmInfoIsSet)
    {
        val[utility::conversions::to_string_t("n2SmInfo")] = ModelBase::toJson(m_N2SmInfo);
    }
    if(m_N2SmInfoTypeIsSet)
    {
        val[utility::conversions::to_string_t("n2SmInfoType")] = ModelBase::toJson(m_N2SmInfoType);
    }
    if(m_IsmfReleaseOnlyIsSet)
    {
        val[utility::conversions::to_string_t("ismfReleaseOnly")] = ModelBase::toJson(m_IsmfReleaseOnly);
    }

    return val;
}

void SmContextReleaseData::fromJson(const web::json::value& val)
{
    if(val.has_field(utility::conversions::to_string_t("cause")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("cause"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<Cause> newItem(new Cause());
            newItem->fromJson(fieldValue);
            setCause( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("ngApCause")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("ngApCause"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<NgApCause> newItem(new NgApCause());
            newItem->fromJson(fieldValue);
            setNgApCause( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("5gMmCauseValue")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("5gMmCauseValue"));
        if(!fieldValue.is_null())
        {
            set5gMmCauseValue(ModelBase::int32_tFromJson(fieldValue));
        }
    }
    if(val.has_field(utility::conversions::to_string_t("ueLocation")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("ueLocation"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<UserLocation> newItem(new UserLocation());
            newItem->fromJson(fieldValue);
            setUeLocation( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("ueTimeZone")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("ueTimeZone"));
        if(!fieldValue.is_null())
        {
            setUeTimeZone(ModelBase::stringFromJson(fieldValue));
        }
    }
    if(val.has_field(utility::conversions::to_string_t("addUeLocation")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("addUeLocation"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<UserLocation> newItem(new UserLocation());
            newItem->fromJson(fieldValue);
            setAddUeLocation( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("vsmfReleaseOnly")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("vsmfReleaseOnly"));
        if(!fieldValue.is_null())
        {
            setVsmfReleaseOnly(ModelBase::boolFromJson(fieldValue));
        }
    }
    if(val.has_field(utility::conversions::to_string_t("n2SmInfo")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("n2SmInfo"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<RefToBinaryData> newItem(new RefToBinaryData());
            newItem->fromJson(fieldValue);
            setN2SmInfo( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("n2SmInfoType")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("n2SmInfoType"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<N2SmInfoType> newItem(new N2SmInfoType());
            newItem->fromJson(fieldValue);
            setN2SmInfoType( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("ismfReleaseOnly")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("ismfReleaseOnly"));
        if(!fieldValue.is_null())
        {
            setIsmfReleaseOnly(ModelBase::boolFromJson(fieldValue));
        }
    }
}

void SmContextReleaseData::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(".");
    }

    if(m_CauseIsSet)
    {
        if (m_Cause.get())
        {
            m_Cause->toMultipart(multipart, utility::conversions::to_string_t("cause."));
        }
    }
    if(m_NgApCauseIsSet)
    {
        if (m_NgApCause.get())
        {
            m_NgApCause->toMultipart(multipart, utility::conversions::to_string_t("ngApCause."));
        }
    }
    if(m__5gMmCauseValueIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("5gMmCauseValue"), m__5gMmCauseValue));
    }
    if(m_UeLocationIsSet)
    {
        if (m_UeLocation.get())
        {
            m_UeLocation->toMultipart(multipart, utility::conversions::to_string_t("ueLocation."));
        }
    }
    if(m_UeTimeZoneIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("ueTimeZone"), m_UeTimeZone));
    }
    if(m_AddUeLocationIsSet)
    {
        if (m_AddUeLocation.get())
        {
            m_AddUeLocation->toMultipart(multipart, utility::conversions::to_string_t("addUeLocation."));
        }
    }
    if(m_VsmfReleaseOnlyIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("vsmfReleaseOnly"), m_VsmfReleaseOnly));
    }
    if(m_N2SmInfoIsSet)
    {
        if (m_N2SmInfo.get())
        {
            m_N2SmInfo->toMultipart(multipart, utility::conversions::to_string_t("n2SmInfo."));
        }
    }
    if(m_N2SmInfoTypeIsSet)
    {
        if (m_N2SmInfoType.get())
        {
            m_N2SmInfoType->toMultipart(multipart, utility::conversions::to_string_t("n2SmInfoType."));
        }
    }
    if(m_IsmfReleaseOnlyIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("ismfReleaseOnly"), m_IsmfReleaseOnly));
    }
}

void SmContextReleaseData::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(".");
    }

    if(multipart->hasContent(utility::conversions::to_string_t("cause")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("cause")))
        {
            std::shared_ptr<Cause> newItem(new Cause());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("cause."));
            setCause( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("ngApCause")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("ngApCause")))
        {
            std::shared_ptr<NgApCause> newItem(new NgApCause());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("ngApCause."));
            setNgApCause( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("5gMmCauseValue")))
    {
        set5gMmCauseValue(ModelBase::int32_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("5gMmCauseValue"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("ueLocation")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("ueLocation")))
        {
            std::shared_ptr<UserLocation> newItem(new UserLocation());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("ueLocation."));
            setUeLocation( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("ueTimeZone")))
    {
        setUeTimeZone(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("ueTimeZone"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("addUeLocation")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("addUeLocation")))
        {
            std::shared_ptr<UserLocation> newItem(new UserLocation());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("addUeLocation."));
            setAddUeLocation( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("vsmfReleaseOnly")))
    {
        setVsmfReleaseOnly(ModelBase::boolFromHttpContent(multipart->getContent(utility::conversions::to_string_t("vsmfReleaseOnly"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("n2SmInfo")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("n2SmInfo")))
        {
            std::shared_ptr<RefToBinaryData> newItem(new RefToBinaryData());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("n2SmInfo."));
            setN2SmInfo( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("n2SmInfoType")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("n2SmInfoType")))
        {
            std::shared_ptr<N2SmInfoType> newItem(new N2SmInfoType());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("n2SmInfoType."));
            setN2SmInfoType( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("ismfReleaseOnly")))
    {
        setIsmfReleaseOnly(ModelBase::boolFromHttpContent(multipart->getContent(utility::conversions::to_string_t("ismfReleaseOnly"))));
    }
}

std::shared_ptr<Cause> SmContextReleaseData::getCause() const
{
    return m_Cause;
}

void SmContextReleaseData::setCause(const std::shared_ptr<Cause>& value)
{
    m_Cause = value;
    m_CauseIsSet = true;
}

bool SmContextReleaseData::causeIsSet() const
{
    return m_CauseIsSet;
}

void SmContextReleaseData::unsetCause()
{
    m_CauseIsSet = false;
}

std::shared_ptr<NgApCause> SmContextReleaseData::getNgApCause() const
{
    return m_NgApCause;
}

void SmContextReleaseData::setNgApCause(const std::shared_ptr<NgApCause>& value)
{
    m_NgApCause = value;
    m_NgApCauseIsSet = true;
}

bool SmContextReleaseData::ngApCauseIsSet() const
{
    return m_NgApCauseIsSet;
}

void SmContextReleaseData::unsetNgApCause()
{
    m_NgApCauseIsSet = false;
}

int32_t SmContextReleaseData::get5gMmCauseValue() const
{
    return m__5gMmCauseValue;
}

void SmContextReleaseData::set5gMmCauseValue(int32_t value)
{
    m__5gMmCauseValue = value;
    m__5gMmCauseValueIsSet = true;
}

bool SmContextReleaseData::_5gMmCauseValueIsSet() const
{
    return m__5gMmCauseValueIsSet;
}

void SmContextReleaseData::unset_5gMmCauseValue()
{
    m__5gMmCauseValueIsSet = false;
}

std::shared_ptr<UserLocation> SmContextReleaseData::getUeLocation() const
{
    return m_UeLocation;
}

void SmContextReleaseData::setUeLocation(const std::shared_ptr<UserLocation>& value)
{
    m_UeLocation = value;
    m_UeLocationIsSet = true;
}

bool SmContextReleaseData::ueLocationIsSet() const
{
    return m_UeLocationIsSet;
}

void SmContextReleaseData::unsetUeLocation()
{
    m_UeLocationIsSet = false;
}

utility::string_t SmContextReleaseData::getUeTimeZone() const
{
    return m_UeTimeZone;
}

void SmContextReleaseData::setUeTimeZone(const utility::string_t& value)
{
    m_UeTimeZone = value;
    m_UeTimeZoneIsSet = true;
}

bool SmContextReleaseData::ueTimeZoneIsSet() const
{
    return m_UeTimeZoneIsSet;
}

void SmContextReleaseData::unsetUeTimeZone()
{
    m_UeTimeZoneIsSet = false;
}

std::shared_ptr<UserLocation> SmContextReleaseData::getAddUeLocation() const
{
    return m_AddUeLocation;
}

void SmContextReleaseData::setAddUeLocation(const std::shared_ptr<UserLocation>& value)
{
    m_AddUeLocation = value;
    m_AddUeLocationIsSet = true;
}

bool SmContextReleaseData::addUeLocationIsSet() const
{
    return m_AddUeLocationIsSet;
}

void SmContextReleaseData::unsetAddUeLocation()
{
    m_AddUeLocationIsSet = false;
}

bool SmContextReleaseData::isVsmfReleaseOnly() const
{
    return m_VsmfReleaseOnly;
}

void SmContextReleaseData::setVsmfReleaseOnly(bool value)
{
    m_VsmfReleaseOnly = value;
    m_VsmfReleaseOnlyIsSet = true;
}

bool SmContextReleaseData::vsmfReleaseOnlyIsSet() const
{
    return m_VsmfReleaseOnlyIsSet;
}

void SmContextReleaseData::unsetVsmfReleaseOnly()
{
    m_VsmfReleaseOnlyIsSet = false;
}

std::shared_ptr<RefToBinaryData> SmContextReleaseData::getN2SmInfo() const
{
    return m_N2SmInfo;
}

void SmContextReleaseData::setN2SmInfo(const std::shared_ptr<RefToBinaryData>& value)
{
    m_N2SmInfo = value;
    m_N2SmInfoIsSet = true;
}

bool SmContextReleaseData::n2SmInfoIsSet() const
{
    return m_N2SmInfoIsSet;
}

void SmContextReleaseData::unsetN2SmInfo()
{
    m_N2SmInfoIsSet = false;
}

std::shared_ptr<N2SmInfoType> SmContextReleaseData::getN2SmInfoType() const
{
    return m_N2SmInfoType;
}

void SmContextReleaseData::setN2SmInfoType(const std::shared_ptr<N2SmInfoType>& value)
{
    m_N2SmInfoType = value;
    m_N2SmInfoTypeIsSet = true;
}

bool SmContextReleaseData::n2SmInfoTypeIsSet() const
{
    return m_N2SmInfoTypeIsSet;
}

void SmContextReleaseData::unsetN2SmInfoType()
{
    m_N2SmInfoTypeIsSet = false;
}

bool SmContextReleaseData::isIsmfReleaseOnly() const
{
    return m_IsmfReleaseOnly;
}

void SmContextReleaseData::setIsmfReleaseOnly(bool value)
{
    m_IsmfReleaseOnly = value;
    m_IsmfReleaseOnlyIsSet = true;
}

bool SmContextReleaseData::ismfReleaseOnlyIsSet() const
{
    return m_IsmfReleaseOnlyIsSet;
}

void SmContextReleaseData::unsetIsmfReleaseOnly()
{
    m_IsmfReleaseOnlyIsSet = false;
}

}
}
}


