///
/// JonPlaybackStateChangeData.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 "onPlaybackStateChangeData.hpp"



namespace margelo::nitro::video {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct onPlaybackStateChangeData by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    onPlaybackStateChangeData toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldIsPlaying = clazz->getField<jboolean>("isPlaying");
      jboolean isPlaying = this->getFieldValue(fieldIsPlaying);
      static const auto fieldIsBuffering = clazz->getField<jboolean>("isBuffering");
      jboolean isBuffering = this->getFieldValue(fieldIsBuffering);
      return onPlaybackStateChangeData(
        static_cast<bool>(isPlaying),
        static_cast<bool>(isBuffering)
      );
    }

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

} // namespace margelo::nitro::video
