///
/// JRegionCenter.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 "RegionCenter.hpp"



namespace margelo::nitro::one {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct RegionCenter by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    RegionCenter toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldLatitude = clazz->getField<double>("latitude");
      double latitude = this->getFieldValue(fieldLatitude);
      static const auto fieldLongitude = clazz->getField<double>("longitude");
      double longitude = this->getFieldValue(fieldLongitude);
      return RegionCenter(
        latitude,
        longitude
      );
    }

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

} // namespace margelo::nitro::one
