///
/// JAutoFocusSystem.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 "AutoFocusSystem.hpp"

namespace margelo::nitro::camera {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::camera
