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

namespace oai::amf::model {

_5GsUserState_anyOf::_5GsUserState_anyOf() {}

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

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

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

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

  return success;
}

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

      ;
}

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

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

  switch (o.getValue()) {
    case _5GsUserState_anyOf::e_5GsUserState_anyOf::
        INVALID_VALUE_OPENAPI_GENERATED:
      j = "INVALID_VALUE_OPENAPI_GENERATED";
      break;
    case _5GsUserState_anyOf::e_5GsUserState_anyOf::DEREGISTERED:
      j = "DEREGISTERED";
      break;
    case _5GsUserState_anyOf::e_5GsUserState_anyOf::
        REGISTERED_NOT_REACHABLE_FOR_PAGING:
      j = "REGISTERED_NOT_REACHABLE_FOR_PAGING";
      break;
    case _5GsUserState_anyOf::e_5GsUserState_anyOf::
        REGISTERED_REACHABLE_FOR_PAGING:
      j = "REGISTERED_REACHABLE_FOR_PAGING";
      break;
    case _5GsUserState_anyOf::e_5GsUserState_anyOf::
        CONNECTED_NOT_REACHABLE_FOR_PAGING:
      j = "CONNECTED_NOT_REACHABLE_FOR_PAGING";
      break;
    case _5GsUserState_anyOf::e_5GsUserState_anyOf::
        CONNECTED_REACHABLE_FOR_PAGING:
      j = "CONNECTED_REACHABLE_FOR_PAGING";
      break;
    case _5GsUserState_anyOf::e_5GsUserState_anyOf::NOT_PROVIDED_FROM_AMF:
      j = "NOT_PROVIDED_FROM_AMF";
      break;
  }
}

void from_json(const nlohmann::json& j, _5GsUserState_anyOf& o) {
  auto s = j.get<std::string>();
  if (s == "DEREGISTERED") {
    o.setValue(_5GsUserState_anyOf::e_5GsUserState_anyOf::DEREGISTERED);
  } else if (s == "REGISTERED_NOT_REACHABLE_FOR_PAGING") {
    o.setValue(_5GsUserState_anyOf::e_5GsUserState_anyOf::
                   REGISTERED_NOT_REACHABLE_FOR_PAGING);
  } else if (s == "REGISTERED_REACHABLE_FOR_PAGING") {
    o.setValue(_5GsUserState_anyOf::e_5GsUserState_anyOf::
                   REGISTERED_REACHABLE_FOR_PAGING);
  } else if (s == "CONNECTED_NOT_REACHABLE_FOR_PAGING") {
    o.setValue(_5GsUserState_anyOf::e_5GsUserState_anyOf::
                   CONNECTED_NOT_REACHABLE_FOR_PAGING);
  } else if (s == "CONNECTED_REACHABLE_FOR_PAGING") {
    o.setValue(_5GsUserState_anyOf::e_5GsUserState_anyOf::
                   CONNECTED_REACHABLE_FOR_PAGING);
  } else if (s == "NOT_PROVIDED_FROM_AMF") {
    o.setValue(
        _5GsUserState_anyOf::e_5GsUserState_anyOf::NOT_PROVIDED_FROM_AMF);
  } else {
    std::stringstream ss;
    ss << "Unexpected value " << s << " in json"
       << " cannot be converted to enum of type"
       << " _5GsUserState_anyOf::e_5GsUserState_anyOf";
    throw std::invalid_argument(ss.str());
  }
}

_5GsUserState_anyOf::e_5GsUserState_anyOf _5GsUserState_anyOf::getValue()
    const {
  return m_value;
}
void _5GsUserState_anyOf::setValue(
    _5GsUserState_anyOf::e_5GsUserState_anyOf value) {
  m_value = value;
}

}  // namespace oai::amf::model
