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

namespace oai {
namespace smf {
namespace model {




QosFlowProfile::QosFlowProfile()
{
    m__5qi = 0;
    m_NonDynamic5QiIsSet = false;
    m_Dynamic5QiIsSet = false;
    m_ArpIsSet = false;
    m_GbrQosFlowInfoIsSet = false;
    m_RqaIsSet = false;
    m_AdditionalQosFlowInfoIsSet = false;
}

QosFlowProfile::~QosFlowProfile()
{
}

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

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

    val[utility::conversions::to_string_t("5qi")] = ModelBase::toJson(m__5qi);
    if(m_NonDynamic5QiIsSet)
    {
        val[utility::conversions::to_string_t("nonDynamic5Qi")] = ModelBase::toJson(m_NonDynamic5Qi);
    }
    if(m_Dynamic5QiIsSet)
    {
        val[utility::conversions::to_string_t("dynamic5Qi")] = ModelBase::toJson(m_Dynamic5Qi);
    }
    if(m_ArpIsSet)
    {
        val[utility::conversions::to_string_t("arp")] = ModelBase::toJson(m_Arp);
    }
    if(m_GbrQosFlowInfoIsSet)
    {
        val[utility::conversions::to_string_t("gbrQosFlowInfo")] = ModelBase::toJson(m_GbrQosFlowInfo);
    }
    if(m_RqaIsSet)
    {
        val[utility::conversions::to_string_t("rqa")] = ModelBase::toJson(m_Rqa);
    }
    if(m_AdditionalQosFlowInfoIsSet)
    {
        val[utility::conversions::to_string_t("additionalQosFlowInfo")] = ModelBase::toJson(m_AdditionalQosFlowInfo);
    }

    return val;
}

void QosFlowProfile::fromJson(const web::json::value& val)
{
    set5qi(ModelBase::int32_tFromJson(val.at(utility::conversions::to_string_t("5qi"))));
    if(val.has_field(utility::conversions::to_string_t("nonDynamic5Qi")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("nonDynamic5Qi"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<NonDynamic5Qi> newItem(new NonDynamic5Qi());
            newItem->fromJson(fieldValue);
            setNonDynamic5Qi( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("dynamic5Qi")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("dynamic5Qi"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<Dynamic5Qi> newItem(new Dynamic5Qi());
            newItem->fromJson(fieldValue);
            setDynamic5Qi( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("arp")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("arp"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<Arp> newItem(new Arp());
            newItem->fromJson(fieldValue);
            setArp( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("gbrQosFlowInfo")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("gbrQosFlowInfo"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<GbrQosFlowInformation> newItem(new GbrQosFlowInformation());
            newItem->fromJson(fieldValue);
            setGbrQosFlowInfo( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("rqa")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("rqa"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<ReflectiveQoSAttribute> newItem(new ReflectiveQoSAttribute());
            newItem->fromJson(fieldValue);
            setRqa( newItem );
        }
    }
    if(val.has_field(utility::conversions::to_string_t("additionalQosFlowInfo")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("additionalQosFlowInfo"));
        if(!fieldValue.is_null())
        {
            std::shared_ptr<AdditionalQosFlowInfo> newItem(new AdditionalQosFlowInfo());
            newItem->fromJson(fieldValue);
            setAdditionalQosFlowInfo( newItem );
        }
    }
}

void QosFlowProfile::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("5qi"), m__5qi));
    if(m_NonDynamic5QiIsSet)
    {
        if (m_NonDynamic5Qi.get())
        {
            m_NonDynamic5Qi->toMultipart(multipart, utility::conversions::to_string_t("nonDynamic5Qi."));
        }
    }
    if(m_Dynamic5QiIsSet)
    {
        if (m_Dynamic5Qi.get())
        {
            m_Dynamic5Qi->toMultipart(multipart, utility::conversions::to_string_t("dynamic5Qi."));
        }
    }
    if(m_ArpIsSet)
    {
        if (m_Arp.get())
        {
            m_Arp->toMultipart(multipart, utility::conversions::to_string_t("arp."));
        }
    }
    if(m_GbrQosFlowInfoIsSet)
    {
        if (m_GbrQosFlowInfo.get())
        {
            m_GbrQosFlowInfo->toMultipart(multipart, utility::conversions::to_string_t("gbrQosFlowInfo."));
        }
    }
    if(m_RqaIsSet)
    {
        if (m_Rqa.get())
        {
            m_Rqa->toMultipart(multipart, utility::conversions::to_string_t("rqa."));
        }
    }
    if(m_AdditionalQosFlowInfoIsSet)
    {
        if (m_AdditionalQosFlowInfo.get())
        {
            m_AdditionalQosFlowInfo->toMultipart(multipart, utility::conversions::to_string_t("additionalQosFlowInfo."));
        }
    }
}

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

    set5qi(ModelBase::int32_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("5qi"))));
    if(multipart->hasContent(utility::conversions::to_string_t("nonDynamic5Qi")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("nonDynamic5Qi")))
        {
            std::shared_ptr<NonDynamic5Qi> newItem(new NonDynamic5Qi());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("nonDynamic5Qi."));
            setNonDynamic5Qi( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("dynamic5Qi")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("dynamic5Qi")))
        {
            std::shared_ptr<Dynamic5Qi> newItem(new Dynamic5Qi());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("dynamic5Qi."));
            setDynamic5Qi( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("arp")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("arp")))
        {
            std::shared_ptr<Arp> newItem(new Arp());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("arp."));
            setArp( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("gbrQosFlowInfo")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("gbrQosFlowInfo")))
        {
            std::shared_ptr<GbrQosFlowInformation> newItem(new GbrQosFlowInformation());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("gbrQosFlowInfo."));
            setGbrQosFlowInfo( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("rqa")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("rqa")))
        {
            std::shared_ptr<ReflectiveQoSAttribute> newItem(new ReflectiveQoSAttribute());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("rqa."));
            setRqa( newItem );
        }
    }
    if(multipart->hasContent(utility::conversions::to_string_t("additionalQosFlowInfo")))
    {
        if(multipart->hasContent(utility::conversions::to_string_t("additionalQosFlowInfo")))
        {
            std::shared_ptr<AdditionalQosFlowInfo> newItem(new AdditionalQosFlowInfo());
            newItem->fromMultiPart(multipart, utility::conversions::to_string_t("additionalQosFlowInfo."));
            setAdditionalQosFlowInfo( newItem );
        }
    }
}

int32_t QosFlowProfile::get5qi() const
{
    return m__5qi;
}

void QosFlowProfile::set5qi(int32_t value)
{
    m__5qi = value;
    
}

std::shared_ptr<NonDynamic5Qi> QosFlowProfile::getNonDynamic5Qi() const
{
    return m_NonDynamic5Qi;
}

void QosFlowProfile::setNonDynamic5Qi(const std::shared_ptr<NonDynamic5Qi>& value)
{
    m_NonDynamic5Qi = value;
    m_NonDynamic5QiIsSet = true;
}

bool QosFlowProfile::nonDynamic5QiIsSet() const
{
    return m_NonDynamic5QiIsSet;
}

void QosFlowProfile::unsetNonDynamic5Qi()
{
    m_NonDynamic5QiIsSet = false;
}

std::shared_ptr<Dynamic5Qi> QosFlowProfile::getDynamic5Qi() const
{
    return m_Dynamic5Qi;
}

void QosFlowProfile::setDynamic5Qi(const std::shared_ptr<Dynamic5Qi>& value)
{
    m_Dynamic5Qi = value;
    m_Dynamic5QiIsSet = true;
}

bool QosFlowProfile::dynamic5QiIsSet() const
{
    return m_Dynamic5QiIsSet;
}

void QosFlowProfile::unsetDynamic5Qi()
{
    m_Dynamic5QiIsSet = false;
}

std::shared_ptr<Arp> QosFlowProfile::getArp() const
{
    return m_Arp;
}

void QosFlowProfile::setArp(const std::shared_ptr<Arp>& value)
{
    m_Arp = value;
    m_ArpIsSet = true;
}

bool QosFlowProfile::arpIsSet() const
{
    return m_ArpIsSet;
}

void QosFlowProfile::unsetArp()
{
    m_ArpIsSet = false;
}

std::shared_ptr<GbrQosFlowInformation> QosFlowProfile::getGbrQosFlowInfo() const
{
    return m_GbrQosFlowInfo;
}

void QosFlowProfile::setGbrQosFlowInfo(const std::shared_ptr<GbrQosFlowInformation>& value)
{
    m_GbrQosFlowInfo = value;
    m_GbrQosFlowInfoIsSet = true;
}

bool QosFlowProfile::gbrQosFlowInfoIsSet() const
{
    return m_GbrQosFlowInfoIsSet;
}

void QosFlowProfile::unsetGbrQosFlowInfo()
{
    m_GbrQosFlowInfoIsSet = false;
}

std::shared_ptr<ReflectiveQoSAttribute> QosFlowProfile::getRqa() const
{
    return m_Rqa;
}

void QosFlowProfile::setRqa(const std::shared_ptr<ReflectiveQoSAttribute>& value)
{
    m_Rqa = value;
    m_RqaIsSet = true;
}

bool QosFlowProfile::rqaIsSet() const
{
    return m_RqaIsSet;
}

void QosFlowProfile::unsetRqa()
{
    m_RqaIsSet = false;
}

std::shared_ptr<AdditionalQosFlowInfo> QosFlowProfile::getAdditionalQosFlowInfo() const
{
    return m_AdditionalQosFlowInfo;
}

void QosFlowProfile::setAdditionalQosFlowInfo(const std::shared_ptr<AdditionalQosFlowInfo>& value)
{
    m_AdditionalQosFlowInfo = value;
    m_AdditionalQosFlowInfoIsSet = true;
}

bool QosFlowProfile::additionalQosFlowInfoIsSet() const
{
    return m_AdditionalQosFlowInfoIsSet;
}

void QosFlowProfile::unsetAdditionalQosFlowInfo()
{
    m_AdditionalQosFlowInfoIsSet = false;
}

}
}
}


