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

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

#include "NitroKryptomOnLoad.hpp"

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

#include "HybridAes.hpp"
#include "HybridDigest.hpp"
#include "HybridHmac.hpp"
#include "HybridRsa.hpp"
#include "HybridStrongRandom.hpp"

namespace margelo::nitro::nitrokryptom {

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

  return facebook::jni::initialize(vm, [] {
    // Register native JNI methods
    

    // Register Nitro Hybrid Objects
    HybridObjectRegistry::registerHybridObjectConstructor(
      "Aes",
      []() -> std::shared_ptr<HybridObject> {
        static_assert(std::is_default_constructible_v<HybridAes>,
                      "The HybridObject \"HybridAes\" is not default-constructible! "
                      "Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
        return std::make_shared<HybridAes>();
      }
    );
    HybridObjectRegistry::registerHybridObjectConstructor(
      "Digest",
      []() -> std::shared_ptr<HybridObject> {
        static_assert(std::is_default_constructible_v<HybridDigest>,
                      "The HybridObject \"HybridDigest\" is not default-constructible! "
                      "Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
        return std::make_shared<HybridDigest>();
      }
    );
    HybridObjectRegistry::registerHybridObjectConstructor(
      "Hmac",
      []() -> std::shared_ptr<HybridObject> {
        static_assert(std::is_default_constructible_v<HybridHmac>,
                      "The HybridObject \"HybridHmac\" is not default-constructible! "
                      "Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
        return std::make_shared<HybridHmac>();
      }
    );
    HybridObjectRegistry::registerHybridObjectConstructor(
      "Rsa",
      []() -> std::shared_ptr<HybridObject> {
        static_assert(std::is_default_constructible_v<HybridRsa>,
                      "The HybridObject \"HybridRsa\" is not default-constructible! "
                      "Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
        return std::make_shared<HybridRsa>();
      }
    );
    HybridObjectRegistry::registerHybridObjectConstructor(
      "StrongRandom",
      []() -> std::shared_ptr<HybridObject> {
        static_assert(std::is_default_constructible_v<HybridStrongRandom>,
                      "The HybridObject \"HybridStrongRandom\" is not default-constructible! "
                      "Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
        return std::make_shared<HybridStrongRandom>();
      }
    );
  });
}

} // namespace margelo::nitro::nitrokryptom
