///
/// MunimBluetooth-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 "MunimBluetooth-Swift-Cxx-Bridge.hpp"

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

namespace margelo::nitro::munimbluetooth::bridge::swift {

  // pragma MARK: std::function<void(const AdvertisingDataTypes& /* result */)>
  Func_void_AdvertisingDataTypes create_Func_void_AdvertisingDataTypes(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = MunimBluetooth::Func_void_AdvertisingDataTypes::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const AdvertisingDataTypes& 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 = MunimBluetooth::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(bool /* result */)>
  Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = MunimBluetooth::Func_void_bool::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
      swiftClosure.call(result);
    };
  }
  
  // pragma MARK: std::function<void()>
  Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = MunimBluetooth::Func_void::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
      swiftClosure.call();
    };
  }
  
  // pragma MARK: std::function<void(const std::vector<GATTService>& /* result */)>
  Func_void_std__vector_GATTService_ create_Func_void_std__vector_GATTService_(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = MunimBluetooth::Func_void_std__vector_GATTService_::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const std::vector<GATTService>& result) mutable -> void {
      swiftClosure.call(result);
    };
  }
  
  // pragma MARK: std::function<void(const CharacteristicValue& /* result */)>
  Func_void_CharacteristicValue create_Func_void_CharacteristicValue(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = MunimBluetooth::Func_void_CharacteristicValue::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const CharacteristicValue& result) mutable -> void {
      swiftClosure.call(result);
    };
  }
  
  // pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
  Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = MunimBluetooth::Func_void_std__vector_std__string_::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const std::vector<std::string>& result) mutable -> void {
      swiftClosure.call(result);
    };
  }
  
  // pragma MARK: std::function<void(double /* result */)>
  Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = MunimBluetooth::Func_void_double::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](double result) mutable -> void {
      swiftClosure.call(result);
    };
  }
  
  // pragma MARK: std::shared_ptr<HybridMunimBluetoothSpec>
  std::shared_ptr<HybridMunimBluetoothSpec> create_std__shared_ptr_HybridMunimBluetoothSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
    MunimBluetooth::HybridMunimBluetoothSpec_cxx swiftPart = MunimBluetooth::HybridMunimBluetoothSpec_cxx::fromUnsafe(swiftUnsafePointer);
    return std::make_shared<margelo::nitro::munimbluetooth::HybridMunimBluetoothSpecSwift>(swiftPart);
  }
  void* NON_NULL get_std__shared_ptr_HybridMunimBluetoothSpec_(std__shared_ptr_HybridMunimBluetoothSpec_ cppType) {
    std::shared_ptr<margelo::nitro::munimbluetooth::HybridMunimBluetoothSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::munimbluetooth::HybridMunimBluetoothSpecSwift>(cppType);
    #ifdef NITRO_DEBUG
    if (swiftWrapper == nullptr) [[unlikely]] {
      throw std::runtime_error("Class \"HybridMunimBluetoothSpec\" is not implemented in Swift!");
    }
    #endif
    MunimBluetooth::HybridMunimBluetoothSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
    return swiftPart.toUnsafe();
  }

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