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

namespace oai::amf::model {

AmfEventType_anyOf::AmfEventType_anyOf() {}

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

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

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

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

  return success;
}

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

      ;
}

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

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

  switch (o.getValue()) {
    case AmfEventType_anyOf::eAmfEventType_anyOf::
        INVALID_VALUE_OPENAPI_GENERATED:
      j = "INVALID_VALUE_OPENAPI_GENERATED";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::LOCATION_REPORT:
      j = "LOCATION_REPORT";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::PRESENCE_IN_AOI_REPORT:
      j = "PRESENCE_IN_AOI_REPORT";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::TIMEZONE_REPORT:
      j = "TIMEZONE_REPORT";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::ACCESS_TYPE_REPORT:
      j = "ACCESS_TYPE_REPORT";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::REGISTRATION_STATE_REPORT:
      j = "REGISTRATION_STATE_REPORT";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::CONNECTIVITY_STATE_REPORT:
      j = "CONNECTIVITY_STATE_REPORT";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::REACHABILITY_REPORT:
      j = "REACHABILITY_REPORT";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::COMMUNICATION_FAILURE_REPORT:
      j = "COMMUNICATION_FAILURE_REPORT";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::UES_IN_AREA_REPORT:
      j = "UES_IN_AREA_REPORT";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::SUBSCRIPTION_ID_CHANGE:
      j = "SUBSCRIPTION_ID_CHANGE";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::SUBSCRIPTION_ID_ADDITION:
      j = "SUBSCRIPTION_ID_ADDITION";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::LOSS_OF_CONNECTIVITY:
      j = "LOSS_OF_CONNECTIVITY";
      break;
    case AmfEventType_anyOf::eAmfEventType_anyOf::_5GS_USER_STATE_REPORT:
      j = "5GS_USER_STATE_REPORT";
      break;
  }
}

void from_json(const nlohmann::json& j, AmfEventType_anyOf& o) {
  auto s = j.get<std::string>();
  if (s == "LOCATION_REPORT") {
    o.setValue(AmfEventType_anyOf::eAmfEventType_anyOf::LOCATION_REPORT);
  } else if (s == "PRESENCE_IN_AOI_REPORT") {
    o.setValue(AmfEventType_anyOf::eAmfEventType_anyOf::PRESENCE_IN_AOI_REPORT);
  } else if (s == "TIMEZONE_REPORT") {
    o.setValue(AmfEventType_anyOf::eAmfEventType_anyOf::TIMEZONE_REPORT);
  } else if (s == "ACCESS_TYPE_REPORT") {
    o.setValue(AmfEventType_anyOf::eAmfEventType_anyOf::ACCESS_TYPE_REPORT);
  } else if (s == "REGISTRATION_STATE_REPORT") {
    o.setValue(
        AmfEventType_anyOf::eAmfEventType_anyOf::REGISTRATION_STATE_REPORT);
  } else if (s == "CONNECTIVITY_STATE_REPORT") {
    o.setValue(
        AmfEventType_anyOf::eAmfEventType_anyOf::CONNECTIVITY_STATE_REPORT);
  } else if (s == "REACHABILITY_REPORT") {
    o.setValue(AmfEventType_anyOf::eAmfEventType_anyOf::REACHABILITY_REPORT);
  } else if (s == "COMMUNICATION_FAILURE_REPORT") {
    o.setValue(
        AmfEventType_anyOf::eAmfEventType_anyOf::COMMUNICATION_FAILURE_REPORT);
  } else if (s == "UES_IN_AREA_REPORT") {
    o.setValue(AmfEventType_anyOf::eAmfEventType_anyOf::UES_IN_AREA_REPORT);
  } else if (s == "SUBSCRIPTION_ID_CHANGE") {
    o.setValue(AmfEventType_anyOf::eAmfEventType_anyOf::SUBSCRIPTION_ID_CHANGE);
  } else if (s == "SUBSCRIPTION_ID_ADDITION") {
    o.setValue(
        AmfEventType_anyOf::eAmfEventType_anyOf::SUBSCRIPTION_ID_ADDITION);
  } else if (s == "LOSS_OF_CONNECTIVITY") {
    o.setValue(AmfEventType_anyOf::eAmfEventType_anyOf::LOSS_OF_CONNECTIVITY);
  } else if (s == "5GS_USER_STATE_REPORT") {
    o.setValue(AmfEventType_anyOf::eAmfEventType_anyOf::_5GS_USER_STATE_REPORT);
  } else {
    std::stringstream ss;
    ss << "Unexpected value " << s << " in json"
       << " cannot be converted to enum of type"
       << " AmfEventType_anyOf::eAmfEventType_anyOf";
    throw std::invalid_argument(ss.str());
  }
}

AmfEventType_anyOf::eAmfEventType_anyOf AmfEventType_anyOf::getValue() const {
  return m_value;
}
void AmfEventType_anyOf::setValue(
    AmfEventType_anyOf::eAmfEventType_anyOf value) {
  m_value = value;
}

}  // namespace oai::amf::model
