///
/// JLocationPosition.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 "LocationPosition.hpp"



namespace margelo::nitro::one {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct LocationPosition by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    LocationPosition 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);
      static const auto fieldAccuracy = clazz->getField<double>("accuracy");
      double accuracy = this->getFieldValue(fieldAccuracy);
      static const auto fieldAltitude = clazz->getField<double>("altitude");
      double altitude = this->getFieldValue(fieldAltitude);
      static const auto fieldAltitudeAccuracy = clazz->getField<double>("altitudeAccuracy");
      double altitudeAccuracy = this->getFieldValue(fieldAltitudeAccuracy);
      static const auto fieldCourse = clazz->getField<double>("course");
      double course = this->getFieldValue(fieldCourse);
      static const auto fieldSpeed = clazz->getField<double>("speed");
      double speed = this->getFieldValue(fieldSpeed);
      static const auto fieldTimestamp = clazz->getField<double>("timestamp");
      double timestamp = this->getFieldValue(fieldTimestamp);
      return LocationPosition(
        latitude,
        longitude,
        accuracy,
        altitude,
        altitudeAccuracy,
        course,
        speed,
        timestamp
      );
    }

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

} // namespace margelo::nitro::one
