/**
 * Namf_EventExposure
 * AMF 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 "LocationFilter_anyOf.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>

namespace oai::amf::model {

LocationFilter_anyOf::LocationFilter_anyOf() {}

void LocationFilter_anyOf::validate() const {
  std::stringstream msg;
  if (!validate(msg)) {
    throw oai::amf::helpers::ValidationException(msg.str());
  }
}

bool LocationFilter_anyOf::validate(std::stringstream& msg) const {
  return validate(msg, "");
}

bool LocationFilter_anyOf::validate(
    std::stringstream& msg, const std::string& pathPrefix) const {
  bool success = true;
  const std::string _pathPrefix =
      pathPrefix.empty() ? "LocationFilter_anyOf" : pathPrefix;

  if (m_value == LocationFilter_anyOf::eLocationFilter_anyOf::
                     INVALID_VALUE_OPENAPI_GENERATED) {
    success = false;
    msg << _pathPrefix << ": has no value;";
  }

  return success;
}

bool LocationFilter_anyOf::operator==(const LocationFilter_anyOf& rhs) const {
  return getValue() == rhs.getValue()

      ;
}

bool LocationFilter_anyOf::operator!=(const LocationFilter_anyOf& rhs) const {
  return !(*this == rhs);
}

void to_json(nlohmann::json& j, const LocationFilter_anyOf& o) {
  j = nlohmann::json();

  switch (o.getValue()) {
    case LocationFilter_anyOf::eLocationFilter_anyOf::
        INVALID_VALUE_OPENAPI_GENERATED:
      j = "INVALID_VALUE_OPENAPI_GENERATED";
      break;
    case LocationFilter_anyOf::eLocationFilter_anyOf::TAI:
      j = "TAI";
      break;
    case LocationFilter_anyOf::eLocationFilter_anyOf::CELL_ID:
      j = "CELL_ID";
      break;
    case LocationFilter_anyOf::eLocationFilter_anyOf::N3IWF:
      j = "N3IWF";
      break;
    case LocationFilter_anyOf::eLocationFilter_anyOf::UE_IP:
      j = "UE_IP";
      break;
    case LocationFilter_anyOf::eLocationFilter_anyOf::UDP_PORT:
      j = "UDP_PORT";
      break;
  }
}

void from_json(const nlohmann::json& j, LocationFilter_anyOf& o) {
  auto s = j.get<std::string>();
  if (s == "TAI") {
    o.setValue(LocationFilter_anyOf::eLocationFilter_anyOf::TAI);
  } else if (s == "CELL_ID") {
    o.setValue(LocationFilter_anyOf::eLocationFilter_anyOf::CELL_ID);
  } else if (s == "N3IWF") {
    o.setValue(LocationFilter_anyOf::eLocationFilter_anyOf::N3IWF);
  } else if (s == "UE_IP") {
    o.setValue(LocationFilter_anyOf::eLocationFilter_anyOf::UE_IP);
  } else if (s == "UDP_PORT") {
    o.setValue(LocationFilter_anyOf::eLocationFilter_anyOf::UDP_PORT);
  } else {
    std::stringstream ss;
    ss << "Unexpected value " << s << " in json"
       << " cannot be converted to enum of type"
       << " LocationFilter_anyOf::eLocationFilter_anyOf";
    throw std::invalid_argument(ss.str());
  }
}

LocationFilter_anyOf::eLocationFilter_anyOf LocationFilter_anyOf::getValue()
    const {
  return m_value;
}
void LocationFilter_anyOf::setValue(
    LocationFilter_anyOf::eLocationFilter_anyOf value) {
  m_value = value;
}

}  // namespace oai::amf::model
