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

namespace oai {
namespace smf {
namespace model {




SmContextRetrieveData::SmContextRetrieveData()
{
    m_TargetMmeCapIsSet = false;
    m_SmContextTypeIsSet = false;
}

SmContextRetrieveData::~SmContextRetrieveData()
{
}

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

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

    if(m_TargetMmeCapIsSet)
    {
        val[utility::conversions::to_string_t("targetMmeCap")] = ModelBase::toJson(m_TargetMmeCap);
    }
    if(m_SmContextTypeIsSet)
    {
        val[utility::conversions::to_string_t("smContextType")] = ModelBase::toJson(m_SmContextType);
    }

    return val;
}

void SmContextRetrieveData::fromJson(const web::json::value& val)
{
    if(val.has_field(utility::conversions::to_string_t("targetMmeCap")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("targetMmeCap"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<MmeCapabilities> newItem(new MmeCapabilities());
            newItem->fromJson(fieldValue);
            setTargetMmeCap( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("smContextType")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("smContextType"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<SmContextType> newItem(new SmContextType());
            newItem->fromJson(fieldValue);
            setSmContextType( newItem );
        }
    }
}

void SmContextRetrieveData::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_TargetMmeCapIsSet)
    {
        if (m_TargetMmeCap.get())
        {
            m_TargetMmeCap->toMultipart(multipart, utility::conversions::to_string_t("targetMmeCap."));
        }
    }
    if(m_SmContextTypeIsSet)
    {
        if (m_SmContextType.get())
        {
            m_SmContextType->toMultipart(multipart, utility::conversions::to_string_t("smContextType."));
        }
    }
}

void SmContextRetrieveData::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("targetMmeCap")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("targetMmeCap")))
        {
            std::shared_ptr<MmeCapabilities> newItem(new MmeCapabilities());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("targetMmeCap."));
            setTargetMmeCap( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("smContextType")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("smContextType")))
        {
            std::shared_ptr<SmContextType> newItem(new SmContextType());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("smContextType."));
            setSmContextType( newItem );
        }
    }
}

std::shared_ptr<MmeCapabilities> SmContextRetrieveData::getTargetMmeCap() const
{
    return m_TargetMmeCap;
}

void SmContextRetrieveData::setTargetMmeCap(const std::shared_ptr<MmeCapabilities>& value)
{
    m_TargetMmeCap = value;
    m_TargetMmeCapIsSet = true;
}

bool SmContextRetrieveData::targetMmeCapIsSet() const
{
    return m_TargetMmeCapIsSet;
}

void SmContextRetrieveData::unsetTargetMmeCap()
{
    m_TargetMmeCapIsSet = false;
}

std::shared_ptr<SmContextType> SmContextRetrieveData::getSmContextType() const
{
    return m_SmContextType;
}

void SmContextRetrieveData::setSmContextType(const std::shared_ptr<SmContextType>& value)
{
    m_SmContextType = value;
    m_SmContextTypeIsSet = true;
}

bool SmContextRetrieveData::smContextTypeIsSet() const
{
    return m_SmContextTypeIsSet;
}

void SmContextRetrieveData::unsetSmContextType()
{
    m_SmContextTypeIsSet = false;
}

}
}
}


