/**
 * Nudr_DataRepository API OpenAPI file
 * Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB,
 * ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
 *
 * The version of the OpenAPI document: 2.1.2
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator
 * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
 * the class manually.
 */

#include "IpAddress.h"

namespace org {
namespace openapitools {
namespace server {
namespace model {

IpAddress::IpAddress() {
  m_Ipv4Addr = "";
  m_Ipv4AddrIsSet = false;
  m_Ipv6AddrIsSet = false;
  m_Ipv6PrefixIsSet = false;
}

IpAddress::~IpAddress() {}

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

void to_json(nlohmann::json &j, const IpAddress &o) {
  j = nlohmann::json();
  if (o.ipv4AddrIsSet())
    j["ipv4Addr"] = o.m_Ipv4Addr;
  if (o.ipv6AddrIsSet())
    j["ipv6Addr"] = o.m_Ipv6Addr;
  if (o.ipv6PrefixIsSet())
    j["ipv6Prefix"] = o.m_Ipv6Prefix;
}

void from_json(const nlohmann::json &j, IpAddress &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("ipv6Prefix") != j.end()) {
    j.at("ipv6Prefix").get_to(o.m_Ipv6Prefix);
    o.m_Ipv6PrefixIsSet = true;
  }
}

std::string IpAddress::getIpv4Addr() const { return m_Ipv4Addr; }
void IpAddress::setIpv4Addr(std::string const &value) {
  m_Ipv4Addr = value;
  m_Ipv4AddrIsSet = true;
}
bool IpAddress::ipv4AddrIsSet() const { return m_Ipv4AddrIsSet; }
void IpAddress::unsetIpv4Addr() { m_Ipv4AddrIsSet = false; }
Ipv6Addr IpAddress::getIpv6Addr() const { return m_Ipv6Addr; }
void IpAddress::setIpv6Addr(Ipv6Addr const &value) {
  m_Ipv6Addr = value;
  m_Ipv6AddrIsSet = true;
}
bool IpAddress::ipv6AddrIsSet() const { return m_Ipv6AddrIsSet; }
void IpAddress::unsetIpv6Addr() { m_Ipv6AddrIsSet = false; }
Ipv6Prefix IpAddress::getIpv6Prefix() const { return m_Ipv6Prefix; }
void IpAddress::setIpv6Prefix(Ipv6Prefix const &value) {
  m_Ipv6Prefix = value;
  m_Ipv6PrefixIsSet = true;
}
bool IpAddress::ipv6PrefixIsSet() const { return m_Ipv6PrefixIsSet; }
void IpAddress::unsetIpv6Prefix() { m_Ipv6PrefixIsSet = false; }

} // namespace model
} // namespace server
} // namespace openapitools
} // namespace org
