///
/// JFunc_void_onLoadStartData.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 <functional>

#include "onLoadStartData.hpp"
#include <functional>
#include "JonLoadStartData.hpp"
#include "SourceType.hpp"
#include "JSourceType.hpp"
#include <memory>
#include "HybridVideoPlayerSourceSpec.hpp"
#include "JHybridVideoPlayerSourceSpec.hpp"

namespace margelo::nitro::video {

  using namespace facebook;

  /**
   * Represents the Java/Kotlin callback `(data: onLoadStartData) -> Unit`.
   * This can be passed around between C++ and Java/Kotlin.
   */
  struct JFunc_void_onLoadStartData: public jni::JavaClass<JFunc_void_onLoadStartData> {
  public:
    static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/video/Func_void_onLoadStartData;";

  public:
    /**
     * Invokes the function this `JFunc_void_onLoadStartData` instance holds through JNI.
     */
    void invoke(const onLoadStartData& data) const {
      static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JonLoadStartData> /* data */)>("invoke");
      method(self(), JonLoadStartData::fromCpp(data));
    }
  };

  /**
   * An implementation of Func_void_onLoadStartData that is backed by a C++ implementation (using `std::function<...>`)
   */
  struct JFunc_void_onLoadStartData_cxx final: public jni::HybridClass<JFunc_void_onLoadStartData_cxx, JFunc_void_onLoadStartData> {
  public:
    static jni::local_ref<JFunc_void_onLoadStartData::javaobject> fromCpp(const std::function<void(const onLoadStartData& /* data */)>& func) {
      return JFunc_void_onLoadStartData_cxx::newObjectCxxArgs(func);
    }

  public:
    /**
     * Invokes the C++ `std::function<...>` this `JFunc_void_onLoadStartData_cxx` instance holds.
     */
    void invoke_cxx(jni::alias_ref<JonLoadStartData> data) {
      _func(data->toCpp());
    }

  public:
    [[nodiscard]]
    inline const std::function<void(const onLoadStartData& /* data */)>& getFunction() const {
      return _func;
    }

  public:
    static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/video/Func_void_onLoadStartData_cxx;";
    static void registerNatives() {
      registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_onLoadStartData_cxx::invoke_cxx)});
    }

  private:
    explicit JFunc_void_onLoadStartData_cxx(const std::function<void(const onLoadStartData& /* data */)>& func): _func(func) { }

  private:
    friend HybridBase;
    std::function<void(const onLoadStartData& /* data */)> _func;
  };

} // namespace margelo::nitro::video
