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

namespace oai {
namespace smf {
namespace model {

NgRanTargetId::NgRanTargetId() {}

NgRanTargetId::~NgRanTargetId() {}

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

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

  val[utility::conversions::to_string_t("ranNodeId")] =
      ModelBase::toJson(m_RanNodeId);
  val[utility::conversions::to_string_t("tai")] = ModelBase::toJson(m_Tai);

  return val;
}

void NgRanTargetId::fromJson(const web::json::value& val) {
  std::shared_ptr<GlobalRanNodeId> newRanNodeId(new GlobalRanNodeId());
  newRanNodeId->fromJson(
      val.at(utility::conversions::to_string_t("ranNodeId")));
  setRanNodeId(newRanNodeId);
  std::shared_ptr<Tai> newTai(new Tai());
  newTai->fromJson(val.at(utility::conversions::to_string_t("tai")));
  setTai(newTai);
}

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

  m_RanNodeId->toMultipart(
      multipart, utility::conversions::to_string_t("ranNodeId."));
  m_Tai->toMultipart(multipart, utility::conversions::to_string_t("tai."));
}

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

  std::shared_ptr<GlobalRanNodeId> newRanNodeId(new GlobalRanNodeId());
  newRanNodeId->fromMultiPart(
      multipart, utility::conversions::to_string_t("ranNodeId."));
  setRanNodeId(newRanNodeId);
  std::shared_ptr<Tai> newTai(new Tai());
  newTai->fromMultiPart(multipart, utility::conversions::to_string_t("tai."));
  setTai(newTai);
}

std::shared_ptr<GlobalRanNodeId> NgRanTargetId::getRanNodeId() const {
  return m_RanNodeId;
}

void NgRanTargetId::setRanNodeId(
    const std::shared_ptr<GlobalRanNodeId>& value) {
  m_RanNodeId = value;
}

std::shared_ptr<Tai> NgRanTargetId::getTai() const {
  return m_Tai;
}

void NgRanTargetId::setTai(const std::shared_ptr<Tai>& value) {
  m_Tai = value;
}

}  // namespace model
}  // namespace smf
}  // namespace oai
