///
/// InappbrowserNitro-Swift-Cxx-Bridge.cpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

#include "InappbrowserNitro-Swift-Cxx-Bridge.hpp"

// Include C++ implementation defined types
#include "HybridInappbrowserNitroSpecSwift.hpp"
#include "InappbrowserNitro-Swift-Cxx-Umbrella.hpp"
#include <NitroModules/NitroDefines.hpp>

namespace margelo::nitro::inappbrowsernitro::bridge::swift {

  // pragma MARK: std::function<void(bool /* result */)>
  Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = InappbrowserNitro::Func_void_bool::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
      swiftClosure.call(result);
    };
  }
  
  // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
  Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = InappbrowserNitro::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
      swiftClosure.call(error);
    };
  }
  
  // pragma MARK: std::function<void(const InAppBrowserResult& /* result */)>
  Func_void_InAppBrowserResult create_Func_void_InAppBrowserResult(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = InappbrowserNitro::Func_void_InAppBrowserResult::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const InAppBrowserResult& result) mutable -> void {
      swiftClosure.call(result);
    };
  }
  
  // pragma MARK: std::function<void(const InAppBrowserAuthResult& /* result */)>
  Func_void_InAppBrowserAuthResult create_Func_void_InAppBrowserAuthResult(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = InappbrowserNitro::Func_void_InAppBrowserAuthResult::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const InAppBrowserAuthResult& result) mutable -> void {
      swiftClosure.call(result);
    };
  }
  
  // pragma MARK: std::function<void()>
  Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = InappbrowserNitro::Func_void::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
      swiftClosure.call();
    };
  }
  
  // pragma MARK: std::shared_ptr<HybridInappbrowserNitroSpec>
  std::shared_ptr<HybridInappbrowserNitroSpec> create_std__shared_ptr_HybridInappbrowserNitroSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
    InappbrowserNitro::HybridInappbrowserNitroSpec_cxx swiftPart = InappbrowserNitro::HybridInappbrowserNitroSpec_cxx::fromUnsafe(swiftUnsafePointer);
    return std::make_shared<margelo::nitro::inappbrowsernitro::HybridInappbrowserNitroSpecSwift>(swiftPart);
  }
  void* NON_NULL get_std__shared_ptr_HybridInappbrowserNitroSpec_(std__shared_ptr_HybridInappbrowserNitroSpec_ cppType) {
    std::shared_ptr<margelo::nitro::inappbrowsernitro::HybridInappbrowserNitroSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::inappbrowsernitro::HybridInappbrowserNitroSpecSwift>(cppType);
    #ifdef NITRO_DEBUG
    if (swiftWrapper == nullptr) [[unlikely]] {
      throw std::runtime_error("Class \"HybridInappbrowserNitroSpec\" is not implemented in Swift!");
    }
    #endif
    InappbrowserNitro::HybridInappbrowserNitroSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
    return swiftPart.toUnsafe();
  }

} // namespace margelo::nitro::inappbrowsernitro::bridge::swift
