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

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

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

  // pragma MARK: std::function<void(bool /* result */)>
  Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionAzure::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 = ClarionAzure::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()>
  Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionAzure::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 = ClarionAzure::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 = ClarionAzure::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 = ClarionAzure::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 NativeAzureError& /* error */)>
  Func_void_NativeAzureError create_Func_void_NativeAzureError(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionAzure::Func_void_NativeAzureError::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const NativeAzureError& error) mutable -> void {
      swiftClosure.call(error);
    };
  }
  
  // pragma MARK: std::function<void(const std::string& /* kind */, double /* offsetMs */)>
  Func_void_std__string_double create_Func_void_std__string_double(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = ClarionAzure::Func_void_std__string_double::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const std::string& kind, double offsetMs) mutable -> void {
      swiftClosure.call(kind, offsetMs);
    };
  }
  
  // pragma MARK: std::shared_ptr<HybridClarionAzureSpec>
  std::shared_ptr<HybridClarionAzureSpec> create_std__shared_ptr_HybridClarionAzureSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
    ClarionAzure::HybridClarionAzureSpec_cxx swiftPart = ClarionAzure::HybridClarionAzureSpec_cxx::fromUnsafe(swiftUnsafePointer);
    return std::make_shared<margelo::nitro::clarion::azure::HybridClarionAzureSpecSwift>(swiftPart);
  }
  void* NON_NULL get_std__shared_ptr_HybridClarionAzureSpec_(std__shared_ptr_HybridClarionAzureSpec_ cppType) {
    std::shared_ptr<margelo::nitro::clarion::azure::HybridClarionAzureSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::clarion::azure::HybridClarionAzureSpecSwift>(cppType);
    #ifdef NITRO_DEBUG
    if (swiftWrapper == nullptr) [[unlikely]] {
      throw std::runtime_error("Class \"HybridClarionAzureSpec\" is not implemented in Swift!");
    }
    #endif
    ClarionAzure::HybridClarionAzureSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
    return swiftPart.toUnsafe();
  }

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