///
/// JLocationData.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 "LocationData.hpp"



namespace margelo::nitro::mediatoolkit {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct LocationData by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    LocationData 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 LocationData(
        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<JLocationData::javaobject> fromCpp(const LocationData& value) {
      using JSignature = JLocationData(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::mediatoolkit
