///
/// JBluetoothPhyOption.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 "BluetoothPhyOption.hpp"

namespace margelo::nitro::munimbluetooth {

  using namespace facebook;

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

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

  public:
    /**
     * Create a Java/Kotlin-based enum with the given C++ enum's value.
     */
    [[maybe_unused]]
    static jni::alias_ref<JBluetoothPhyOption> fromCpp(BluetoothPhyOption value) {
      static const auto clazz = javaClassStatic();
      switch (value) {
        case BluetoothPhyOption::NONE:
          static const auto fieldNONE = clazz->getStaticField<JBluetoothPhyOption>("NONE");
          return clazz->getStaticFieldValue(fieldNONE);
        case BluetoothPhyOption::S2:
          static const auto fieldS2 = clazz->getStaticField<JBluetoothPhyOption>("S2");
          return clazz->getStaticFieldValue(fieldS2);
        case BluetoothPhyOption::S8:
          static const auto fieldS8 = clazz->getStaticField<JBluetoothPhyOption>("S8");
          return clazz->getStaticFieldValue(fieldS8);
        default:
          std::string stringValue = std::to_string(static_cast<int>(value));
          throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
      }
    }
  };

} // namespace margelo::nitro::munimbluetooth
