/**
 * Nsmf_EventExposure
 * Session Management Event Exposure 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
 * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
 * the class manually.
 */

#include "DddTrafficDescriptor.h"

namespace oai {
namespace smf_server {
namespace model {

DddTrafficDescriptor::DddTrafficDescriptor() {
  m_Ipv4Addr      = "";
  m_Ipv4AddrIsSet = false;
  m_Ipv6AddrIsSet = false;
  m_Port          = 0;
  m_PortIsSet     = false;
}

DddTrafficDescriptor::~DddTrafficDescriptor() {}

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

void to_json(nlohmann::json& j, const DddTrafficDescriptor& o) {
  j = nlohmann::json();
  if (o.ipv4AddrIsSet()) j["ipv4Addr"] = o.m_Ipv4Addr;
  if (o.ipv6AddrIsSet()) j["ipv6Addr"] = o.m_Ipv6Addr;
  if (o.portIsSet()) j["port"] = o.m_Port;
}

void from_json(const nlohmann::json& j, DddTrafficDescriptor& o) {
  if (j.find("ipv4Addr") != j.end()) {
    j.at("ipv4Addr").get_to(o.m_Ipv4Addr);
    o.m_Ipv4AddrIsSet = true;
  }
  if (j.find("ipv6Addr") != j.end()) {
    j.at("ipv6Addr").get_to(o.m_Ipv6Addr);
    o.m_Ipv6AddrIsSet = true;
  }
  if (j.find("port") != j.end()) {
    j.at("port").get_to(o.m_Port);
    o.m_PortIsSet = true;
  }
}

std::string DddTrafficDescriptor::getIpv4Addr() const {
  return m_Ipv4Addr;
}
void DddTrafficDescriptor::setIpv4Addr(std::string const& value) {
  m_Ipv4Addr      = value;
  m_Ipv4AddrIsSet = true;
}
bool DddTrafficDescriptor::ipv4AddrIsSet() const {
  return m_Ipv4AddrIsSet;
}
void DddTrafficDescriptor::unsetIpv4Addr() {
  m_Ipv4AddrIsSet = false;
}
Ipv6Addr DddTrafficDescriptor::getIpv6Addr() const {
  return m_Ipv6Addr;
}
void DddTrafficDescriptor::setIpv6Addr(Ipv6Addr const& value) {
  m_Ipv6Addr      = value;
  m_Ipv6AddrIsSet = true;
}
bool DddTrafficDescriptor::ipv6AddrIsSet() const {
  return m_Ipv6AddrIsSet;
}
void DddTrafficDescriptor::unsetIpv6Addr() {
  m_Ipv6AddrIsSet = false;
}
int32_t DddTrafficDescriptor::getPort() const {
  return m_Port;
}
void DddTrafficDescriptor::setPort(int32_t const value) {
  m_Port      = value;
  m_PortIsSet = true;
}
bool DddTrafficDescriptor::portIsSet() const {
  return m_PortIsSet;
}
void DddTrafficDescriptor::unsetPort() {
  m_PortIsSet = false;
}

}  // namespace model
}  // namespace smf_server
}  // namespace oai
