///
/// JPTSessionStatus.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

#pragma once

#include <fbjni/fbjni.h>
#include "PTSessionStatus.hpp"

namespace margelo::nitro::espprovtoolkit {

  using namespace facebook;

  /**
   * The C++ JNI bridge between the C++ enum "PTSessionStatus" and the the Kotlin enum "PTSessionStatus".
   */
  struct JPTSessionStatus final: public jni::JavaClass<JPTSessionStatus> {
  public:
    static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/espprovtoolkit/PTSessionStatus;";

  public:
    /**
     * Convert this Java/Kotlin-based enum to the C++ enum PTSessionStatus.
     */
    [[maybe_unused]]
    [[nodiscard]]
    PTSessionStatus toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldOrdinal = clazz->getField<int>("value");
      int ordinal = this->getFieldValue(fieldOrdinal);
      return static_cast<PTSessionStatus>(ordinal);
    }

  public:
    /**
     * Create a Java/Kotlin-based enum with the given C++ enum's value.
     */
    [[maybe_unused]]
    static jni::alias_ref<JPTSessionStatus> fromCpp(PTSessionStatus value) {
      static const auto clazz = javaClassStatic();
      switch (value) {
        case PTSessionStatus::CONNECTED:
          static const auto fieldCONNECTED = clazz->getStaticField<JPTSessionStatus>("CONNECTED");
          return clazz->getStaticFieldValue(fieldCONNECTED);
        case PTSessionStatus::CHECK_MANUALLY:
          static const auto fieldCHECK_MANUALLY = clazz->getStaticField<JPTSessionStatus>("CHECK_MANUALLY");
          return clazz->getStaticFieldValue(fieldCHECK_MANUALLY);
        case PTSessionStatus::DISCONNECTED:
          static const auto fieldDISCONNECTED = clazz->getStaticField<JPTSessionStatus>("DISCONNECTED");
          return clazz->getStaticFieldValue(fieldDISCONNECTED);
        default:
          std::string stringValue = std::to_string(static_cast<int>(value));
          throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
      }
    }
  };

} // namespace margelo::nitro::espprovtoolkit
