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

#pragma once

#include <fbjni/fbjni.h>
#include <functional>

#include <string>
#include "NativeNotification.hpp"
#include <functional>
#include <NitroModules/JNICallable.hpp>
#include "JNativeNotification.hpp"
#include "NativeNotificationRequest.hpp"
#include "JNativeNotificationRequest.hpp"
#include "NativeContent.hpp"
#include "JNativeContent.hpp"
#include <optional>
#include <NitroModules/AnyMap.hpp>
#include <NitroModules/JAnyMap.hpp>
#include "NativeTrigger.hpp"
#include "JNativeTrigger.hpp"
#include "NativeTriggerType.hpp"
#include "JNativeTriggerType.hpp"

namespace margelo::nitro::one {

  using namespace facebook;

  /**
   * Represents the Java/Kotlin callback `(requestId: String, notification: NativeNotification) -> Unit`.
   * This can be passed around between C++ and Java/Kotlin.
   */
  struct JFunc_void_std__string_NativeNotification: public jni::JavaClass<JFunc_void_std__string_NativeNotification> {
  public:
    static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/one/Func_void_std__string_NativeNotification;";

  public:
    /**
     * Invokes the function this `JFunc_void_std__string_NativeNotification` instance holds through JNI.
     */
    void invoke(const std::string& requestId, const NativeNotification& notification) const {
      static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* requestId */, jni::alias_ref<JNativeNotification> /* notification */)>("invoke");
      method(self(), jni::make_jstring(requestId), JNativeNotification::fromCpp(notification));
    }
  };

  /**
   * An implementation of Func_void_std__string_NativeNotification that is backed by a C++ implementation (using `std::function<...>`)
   */
  class JFunc_void_std__string_NativeNotification_cxx final: public jni::HybridClass<JFunc_void_std__string_NativeNotification_cxx, JFunc_void_std__string_NativeNotification> {
  public:
    static jni::local_ref<JFunc_void_std__string_NativeNotification::javaobject> fromCpp(const std::function<void(const std::string& /* requestId */, const NativeNotification& /* notification */)>& func) {
      return JFunc_void_std__string_NativeNotification_cxx::newObjectCxxArgs(func);
    }

  public:
    /**
     * Invokes the C++ `std::function<...>` this `JFunc_void_std__string_NativeNotification_cxx` instance holds.
     */
    void invoke_cxx(jni::alias_ref<jni::JString> requestId, jni::alias_ref<JNativeNotification> notification) {
      _func(requestId->toStdString(), notification->toCpp());
    }

  public:
    [[nodiscard]]
    inline const std::function<void(const std::string& /* requestId */, const NativeNotification& /* notification */)>& getFunction() const {
      return _func;
    }

  public:
    static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/one/Func_void_std__string_NativeNotification_cxx;";
    static void registerNatives() {
      registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_NativeNotification_cxx::invoke_cxx)});
    }

  private:
    explicit JFunc_void_std__string_NativeNotification_cxx(const std::function<void(const std::string& /* requestId */, const NativeNotification& /* notification */)>& func): _func(func) { }

  private:
    friend HybridBase;
    std::function<void(const std::string& /* requestId */, const NativeNotification& /* notification */)> _func;
  };

} // namespace margelo::nitro::one
