///
/// JBarcodeScannerOutputResolution.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 "BarcodeScannerOutputResolution.hpp"

namespace margelo::nitro::camera::barcodescanner {

  using namespace facebook;

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

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

  public:
    /**
     * Create a Java/Kotlin-based enum with the given C++ enum's value.
     */
    [[maybe_unused]]
    static jni::alias_ref<JBarcodeScannerOutputResolution> fromCpp(BarcodeScannerOutputResolution value) {
      static const auto clazz = javaClassStatic();
      switch (value) {
        case BarcodeScannerOutputResolution::PREVIEW:
          static const auto fieldPREVIEW = clazz->getStaticField<JBarcodeScannerOutputResolution>("PREVIEW");
          return clazz->getStaticFieldValue(fieldPREVIEW);
        case BarcodeScannerOutputResolution::FULL:
          static const auto fieldFULL = clazz->getStaticField<JBarcodeScannerOutputResolution>("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::barcodescanner
