///
/// JBounds.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 "Bounds.hpp"



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

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct Bounds by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    Bounds toCpp() const {
      static const auto clazz = javaClassStatic();
      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);
      static const auto fieldX = clazz->getField<double>("x");
      double x = this->getFieldValue(fieldX);
      static const auto fieldY = clazz->getField<double>("y");
      double y = this->getFieldValue(fieldY);
      return Bounds(
        width,
        height,
        x,
        y
      );
    }

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

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