///
/// JonProgressData.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 Marc Rousavy @ Margelo
///

#pragma once

#include <fbjni/fbjni.h>
#include "onProgressData.hpp"



namespace margelo::nitro::video {

  using namespace facebook;

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

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

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JonProgressData::javaobject> fromCpp(const onProgressData& value) {
      return newInstance(
        value.currentTime,
        value.bufferDuration
      );
    }
  };

} // namespace margelo::nitro::video
