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

namespace oai {
namespace smf {
namespace model {




ExemptionInd::ExemptionInd()
{
    m_DnnCongestion = false;
    m_DnnCongestionIsSet = false;
    m_SnssaiOnlyCongestion = false;
    m_SnssaiOnlyCongestionIsSet = false;
    m_SnssaiDnnCongestion = false;
    m_SnssaiDnnCongestionIsSet = false;
}

ExemptionInd::~ExemptionInd()
{
}

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

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

    if(m_DnnCongestionIsSet)
    {
        val[utility::conversions::to_string_t("dnnCongestion")] = ModelBase::toJson(m_DnnCongestion);
    }
    if(m_SnssaiOnlyCongestionIsSet)
    {
        val[utility::conversions::to_string_t("snssaiOnlyCongestion")] = ModelBase::toJson(m_SnssaiOnlyCongestion);
    }
    if(m_SnssaiDnnCongestionIsSet)
    {
        val[utility::conversions::to_string_t("snssaiDnnCongestion")] = ModelBase::toJson(m_SnssaiDnnCongestion);
    }

    return val;
}

void ExemptionInd::fromJson(const web::json::value& val)
{
    if(val.has_field(utility::conversions::to_string_t("dnnCongestion")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("dnnCongestion"));
        if(!fieldValue.is_null())
        {
            setDnnCongestion(ModelBase::boolFromJson(fieldValue));
        }
    }
    if(val.has_field(utility::conversions::to_string_t("snssaiOnlyCongestion")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("snssaiOnlyCongestion"));
        if(!fieldValue.is_null())
        {
            setSnssaiOnlyCongestion(ModelBase::boolFromJson(fieldValue));
        }
    }
    if(val.has_field(utility::conversions::to_string_t("snssaiDnnCongestion")))
    {
        const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("snssaiDnnCongestion"));
        if(!fieldValue.is_null())
        {
            setSnssaiDnnCongestion(ModelBase::boolFromJson(fieldValue));
        }
    }
}

void ExemptionInd::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_DnnCongestionIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("dnnCongestion"), m_DnnCongestion));
    }
    if(m_SnssaiOnlyCongestionIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("snssaiOnlyCongestion"), m_SnssaiOnlyCongestion));
    }
    if(m_SnssaiDnnCongestionIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("snssaiDnnCongestion"), m_SnssaiDnnCongestion));
    }
}

void ExemptionInd::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("dnnCongestion")))
    {
        setDnnCongestion(ModelBase::boolFromHttpContent(multipart->getContent(utility::conversions::to_string_t("dnnCongestion"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("snssaiOnlyCongestion")))
    {
        setSnssaiOnlyCongestion(ModelBase::boolFromHttpContent(multipart->getContent(utility::conversions::to_string_t("snssaiOnlyCongestion"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("snssaiDnnCongestion")))
    {
        setSnssaiDnnCongestion(ModelBase::boolFromHttpContent(multipart->getContent(utility::conversions::to_string_t("snssaiDnnCongestion"))));
    }
}

bool ExemptionInd::isDnnCongestion() const
{
    return m_DnnCongestion;
}

void ExemptionInd::setDnnCongestion(bool value)
{
    m_DnnCongestion = value;
    m_DnnCongestionIsSet = true;
}

bool ExemptionInd::dnnCongestionIsSet() const
{
    return m_DnnCongestionIsSet;
}

void ExemptionInd::unsetDnnCongestion()
{
    m_DnnCongestionIsSet = false;
}

bool ExemptionInd::isSnssaiOnlyCongestion() const
{
    return m_SnssaiOnlyCongestion;
}

void ExemptionInd::setSnssaiOnlyCongestion(bool value)
{
    m_SnssaiOnlyCongestion = value;
    m_SnssaiOnlyCongestionIsSet = true;
}

bool ExemptionInd::snssaiOnlyCongestionIsSet() const
{
    return m_SnssaiOnlyCongestionIsSet;
}

void ExemptionInd::unsetSnssaiOnlyCongestion()
{
    m_SnssaiOnlyCongestionIsSet = false;
}

bool ExemptionInd::isSnssaiDnnCongestion() const
{
    return m_SnssaiDnnCongestion;
}

void ExemptionInd::setSnssaiDnnCongestion(bool value)
{
    m_SnssaiDnnCongestion = value;
    m_SnssaiDnnCongestionIsSet = true;
}

bool ExemptionInd::snssaiDnnCongestionIsSet() const
{
    return m_SnssaiDnnCongestionIsSet;
}

void ExemptionInd::unsetSnssaiDnnCongestion()
{
    m_SnssaiDnnCongestionIsSet = false;
}

}
}
}


