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

namespace oai::amf::model {

UeReachability_anyOf::UeReachability_anyOf() {}

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

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

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

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

  return success;
}

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

      ;
}

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

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

  switch (o.getValue()) {
    case UeReachability_anyOf::eUeReachability_anyOf::
        INVALID_VALUE_OPENAPI_GENERATED:
      j = "INVALID_VALUE_OPENAPI_GENERATED";
      break;
    case UeReachability_anyOf::eUeReachability_anyOf::UNREACHABLE:
      j = "UNREACHABLE";
      break;
    case UeReachability_anyOf::eUeReachability_anyOf::REACHABLE:
      j = "REACHABLE";
      break;
    case UeReachability_anyOf::eUeReachability_anyOf::REGULATORY_ONLY:
      j = "REGULATORY_ONLY";
      break;
  }
}

void from_json(const nlohmann::json& j, UeReachability_anyOf& o) {
  auto s = j.get<std::string>();
  if (s == "UNREACHABLE") {
    o.setValue(UeReachability_anyOf::eUeReachability_anyOf::UNREACHABLE);
  } else if (s == "REACHABLE") {
    o.setValue(UeReachability_anyOf::eUeReachability_anyOf::REACHABLE);
  } else if (s == "REGULATORY_ONLY") {
    o.setValue(UeReachability_anyOf::eUeReachability_anyOf::REGULATORY_ONLY);
  } else {
    std::stringstream ss;
    ss << "Unexpected value " << s << " in json"
       << " cannot be converted to enum of type"
       << " UeReachability_anyOf::eUeReachability_anyOf";
    throw std::invalid_argument(ss.str());
  }
}

UeReachability_anyOf::eUeReachability_anyOf UeReachability_anyOf::getValue()
    const {
  return m_value;
}
void UeReachability_anyOf::setValue(
    UeReachability_anyOf::eUeReachability_anyOf value) {
  m_value = value;
}

}  // namespace oai::amf::model
