///
/// JScanRegion.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 "ScanRegion.hpp"



namespace margelo::nitro::visioncameraocrplus {

  using namespace facebook;

  /**
   * The C++ JNI bridge between the C++ struct "ScanRegion" and the the Kotlin data class "ScanRegion".
   */
  struct JScanRegion final: public jni::JavaClass<JScanRegion> {
  public:
    static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameraocrplus/ScanRegion;";

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct ScanRegion by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    ScanRegion toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldLeft = clazz->getField<double>("left");
      double left = this->getFieldValue(fieldLeft);
      static const auto fieldTop = clazz->getField<double>("top");
      double top = this->getFieldValue(fieldTop);
      static const auto fieldWidth = clazz->getField<double>("width");
      double width = this->getFieldValue(fieldWidth);
      static const auto fieldHeight = clazz->getField<double>("height");
      double height = this->getFieldValue(fieldHeight);
      return ScanRegion(
        left,
        top,
        width,
        height
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JScanRegion::javaobject> fromCpp(const ScanRegion& value) {
      using JSignature = JScanRegion(double, double, double, double);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        value.left,
        value.top,
        value.width,
        value.height
      );
    }
  };

} // namespace margelo::nitro::visioncameraocrplus
