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

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

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

namespace margelo::nitro::nitroshareintent::bridge::swift {

  // pragma MARK: std::function<void(const std::optional<SharePayload>& /* result */)>
  Func_void_std__optional_SharePayload_ create_Func_void_std__optional_SharePayload_(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = NitroShareIntent::Func_void_std__optional_SharePayload_::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const std::optional<SharePayload>& 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 = NitroShareIntent::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 SharePayload& /* payload */)>
  Func_void_SharePayload create_Func_void_SharePayload(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = NitroShareIntent::Func_void_SharePayload::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const SharePayload& payload) mutable -> void {
      swiftClosure.call(payload);
    };
  }
  
  // pragma MARK: std::function<void(const std::string& /* message */)>
  Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = NitroShareIntent::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const std::string& message) mutable -> void {
      swiftClosure.call(message);
    };
  }
  
  // pragma MARK: std::shared_ptr<HybridNitroShareIntentSpec>
  std::shared_ptr<HybridNitroShareIntentSpec> create_std__shared_ptr_HybridNitroShareIntentSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
    NitroShareIntent::HybridNitroShareIntentSpec_cxx swiftPart = NitroShareIntent::HybridNitroShareIntentSpec_cxx::fromUnsafe(swiftUnsafePointer);
    return std::make_shared<margelo::nitro::nitroshareintent::HybridNitroShareIntentSpecSwift>(swiftPart);
  }
  void* NON_NULL get_std__shared_ptr_HybridNitroShareIntentSpec_(std__shared_ptr_HybridNitroShareIntentSpec_ cppType) {
    std::shared_ptr<margelo::nitro::nitroshareintent::HybridNitroShareIntentSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::nitroshareintent::HybridNitroShareIntentSpecSwift>(cppType);
    #ifdef NITRO_DEBUG
    if (swiftWrapper == nullptr) [[unlikely]] {
      throw std::runtime_error("Class \"HybridNitroShareIntentSpec\" is not implemented in Swift!");
    }
    #endif
    NitroShareIntent::HybridNitroShareIntentSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
    return swiftPart.toUnsafe();
  }

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