///
/// JRange.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 "Range.hpp"



namespace margelo::nitro::camera {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::camera
