///
/// JCornerPoint.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 "CornerPoint.hpp"



namespace margelo::nitro::visioncameraocrplus {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct CornerPoint by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    CornerPoint toCpp() const {
      static const auto clazz = javaClassStatic();
      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 CornerPoint(
        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<JCornerPoint::javaobject> fromCpp(const CornerPoint& value) {
      using JSignature = JCornerPoint(double, double);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        value.x,
        value.y
      );
    }
  };

} // namespace margelo::nitro::visioncameraocrplus
