///
/// JLightSensorMeasurement.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 "LightSensorMeasurement.hpp"



namespace margelo::nitro::one {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct LightSensorMeasurement by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    LightSensorMeasurement toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldIlluminance = clazz->getField<double>("illuminance");
      double illuminance = this->getFieldValue(fieldIlluminance);
      static const auto fieldTimestamp = clazz->getField<double>("timestamp");
      double timestamp = this->getFieldValue(fieldTimestamp);
      return LightSensorMeasurement(
        illuminance,
        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<JLightSensorMeasurement::javaobject> fromCpp(const LightSensorMeasurement& value) {
      using JSignature = JLightSensorMeasurement(double, double);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        value.illuminance,
        value.timestamp
      );
    }
  };

} // namespace margelo::nitro::one
