///
/// JFaceDetectorOutputResolution.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 "FaceDetectorOutputResolution.hpp"

namespace margelo::nitro::camera::facedetector {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::camera::facedetector
