///
/// JSceneAdaptiveness.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 "SceneAdaptiveness.hpp"

namespace margelo::nitro::camera {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::camera
