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

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

namespace margelo::nitro::clarion::recognizer::bridge::swift {

  // pragma MARK: std::function<void(bool /* result */)>
  Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionRecognizer::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 = ClarionRecognizer::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 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 = ClarionRecognizer::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()>
  Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionRecognizer::Func_void::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
      swiftClosure.call();
    };
  }
  
  // pragma MARK: std::function<void(const NativeTranscriptResult& /* result */)>
  Func_void_NativeTranscriptResult create_Func_void_NativeTranscriptResult(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionRecognizer::Func_void_NativeTranscriptResult::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const NativeTranscriptResult& result) mutable -> void {
      swiftClosure.call(result);
    };
  }
  
  // pragma MARK: std::function<void(const std::string& /* state */)>
  Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionRecognizer::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const std::string& state) mutable -> void {
      swiftClosure.call(state);
    };
  }
  
  // pragma MARK: std::function<void(double /* rms */, double /* peak */)>
  Func_void_double_double create_Func_void_double_double(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionRecognizer::Func_void_double_double::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](double rms, double peak) mutable -> void {
      swiftClosure.call(rms, peak);
    };
  }
  
  // pragma MARK: std::function<void(const NativeRecognizerError& /* error */)>
  Func_void_NativeRecognizerError create_Func_void_NativeRecognizerError(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionRecognizer::Func_void_NativeRecognizerError::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const NativeRecognizerError& error) mutable -> void {
      swiftClosure.call(error);
    };
  }
  
  // pragma MARK: std::shared_ptr<HybridClarionRecognizerSpec>
  std::shared_ptr<HybridClarionRecognizerSpec> create_std__shared_ptr_HybridClarionRecognizerSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
    ClarionRecognizer::HybridClarionRecognizerSpec_cxx swiftPart = ClarionRecognizer::HybridClarionRecognizerSpec_cxx::fromUnsafe(swiftUnsafePointer);
    return std::make_shared<margelo::nitro::clarion::recognizer::HybridClarionRecognizerSpecSwift>(swiftPart);
  }
  void* NON_NULL get_std__shared_ptr_HybridClarionRecognizerSpec_(std__shared_ptr_HybridClarionRecognizerSpec_ cppType) {
    std::shared_ptr<margelo::nitro::clarion::recognizer::HybridClarionRecognizerSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::clarion::recognizer::HybridClarionRecognizerSpecSwift>(cppType);
    #ifdef NITRO_DEBUG
    if (swiftWrapper == nullptr) [[unlikely]] {
      throw std::runtime_error("Class \"HybridClarionRecognizerSpec\" is not implemented in Swift!");
    }
    #endif
    ClarionRecognizer::HybridClarionRecognizerSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
    return swiftPart.toUnsafe();
  }

} // namespace margelo::nitro::clarion::recognizer::bridge::swift
