///
/// JRectangularLocationBounds.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 "RectangularLocationBounds.hpp"



namespace margelo::nitro::googleplaces {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct RectangularLocationBounds by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    RectangularLocationBounds toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldSouthWestLatitude = clazz->getField<double>("southWestLatitude");
      double southWestLatitude = this->getFieldValue(fieldSouthWestLatitude);
      static const auto fieldSouthWestLongitude = clazz->getField<double>("southWestLongitude");
      double southWestLongitude = this->getFieldValue(fieldSouthWestLongitude);
      static const auto fieldNorthEastLatitude = clazz->getField<double>("northEastLatitude");
      double northEastLatitude = this->getFieldValue(fieldNorthEastLatitude);
      static const auto fieldNorthEastLongitude = clazz->getField<double>("northEastLongitude");
      double northEastLongitude = this->getFieldValue(fieldNorthEastLongitude);
      return RectangularLocationBounds(
        southWestLatitude,
        southWestLongitude,
        northEastLatitude,
        northEastLongitude
      );
    }

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

} // namespace margelo::nitro::googleplaces
