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

#ifndef BUILDING_REACTNATIVEVIDEO_WITH_GENERATED_CMAKE_PROJECT
#error ReactNativeVideoOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
#endif

#include "ReactNativeVideoOnLoad.hpp"

#include <jni.h>
#include <fbjni/fbjni.h>
#include <NitroModules/HybridObjectRegistry.hpp>

#include "JHybridVideoPlayerSpec.hpp"
#include "JHybridVideoPlayerFactorySpec.hpp"
#include "JHybridVideoPlayerEventEmitterSpec.hpp"
#include "JFunc_void.hpp"
#include "JFunc_void_bool.hpp"
#include "JFunc_void_BandwidthData.hpp"
#include "JFunc_void_onLoadData.hpp"
#include "JFunc_void_onLoadStartData.hpp"
#include "JFunc_void_onPlaybackStateChangeData.hpp"
#include "JFunc_void_double.hpp"
#include "JFunc_void_onProgressData.hpp"
#include "JFunc_void_TimedMetadata.hpp"
#include "JFunc_void_std__vector_std__string_.hpp"
#include "JFunc_void_std__optional_TextTrack_.hpp"
#include "JFunc_void_onVolumeChangeData.hpp"
#include "JFunc_void_VideoPlayerStatus.hpp"
#include "JHybridVideoPlayerSourceSpec.hpp"
#include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.hpp"
#include "JHybridVideoPlayerSourceFactorySpec.hpp"
#include "JHybridVideoViewViewManagerSpec.hpp"
#include "JHybridVideoViewViewManagerFactorySpec.hpp"
#include <NitroModules/DefaultConstructableObject.hpp>

namespace margelo::nitro::video {

int initialize(JavaVM* vm) {
  using namespace margelo::nitro;
  using namespace margelo::nitro::video;
  using namespace facebook;

  return facebook::jni::initialize(vm, [] {
    // Register native JNI methods
    margelo::nitro::video::JHybridVideoPlayerSpec::registerNatives();
    margelo::nitro::video::JHybridVideoPlayerFactorySpec::registerNatives();
    margelo::nitro::video::JHybridVideoPlayerEventEmitterSpec::registerNatives();
    margelo::nitro::video::JFunc_void_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_bool_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_BandwidthData_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_onLoadData_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_onLoadStartData_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_onPlaybackStateChangeData_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_double_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_onProgressData_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_TimedMetadata_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_std__vector_std__string__cxx::registerNatives();
    margelo::nitro::video::JFunc_void_std__optional_TextTrack__cxx::registerNatives();
    margelo::nitro::video::JFunc_void_onVolumeChangeData_cxx::registerNatives();
    margelo::nitro::video::JFunc_void_VideoPlayerStatus_cxx::registerNatives();
    margelo::nitro::video::JHybridVideoPlayerSourceSpec::registerNatives();
    margelo::nitro::video::JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_cxx::registerNatives();
    margelo::nitro::video::JHybridVideoPlayerSourceFactorySpec::registerNatives();
    margelo::nitro::video::JHybridVideoViewViewManagerSpec::registerNatives();
    margelo::nitro::video::JHybridVideoViewViewManagerFactorySpec::registerNatives();

    // Register Nitro Hybrid Objects
    HybridObjectRegistry::registerHybridObjectConstructor(
      "VideoPlayerFactory",
      []() -> std::shared_ptr<HybridObject> {
        static DefaultConstructableObject<JHybridVideoPlayerFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoPlayerFactory");
        auto instance = object.create();
        auto globalRef = jni::make_global(instance);
        return globalRef->cthis()->shared();
      }
    );
    HybridObjectRegistry::registerHybridObjectConstructor(
      "VideoPlayerSourceFactory",
      []() -> std::shared_ptr<HybridObject> {
        static DefaultConstructableObject<JHybridVideoPlayerSourceFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoPlayerSourceFactory");
        auto instance = object.create();
        auto globalRef = jni::make_global(instance);
        return globalRef->cthis()->shared();
      }
    );
    HybridObjectRegistry::registerHybridObjectConstructor(
      "VideoViewViewManagerFactory",
      []() -> std::shared_ptr<HybridObject> {
        static DefaultConstructableObject<JHybridVideoViewViewManagerFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoViewViewManagerFactory");
        auto instance = object.create();
        auto globalRef = jni::make_global(instance);
        return globalRef->cthis()->shared();
      }
    );
  });
}

} // namespace margelo::nitro::video
