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

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

namespace margelo::nitro::sound::bridge::swift {

  // pragma MARK: std::function<void(const std::string& /* result */)>
  Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = NitroSound::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const std::string& 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 = NitroSound::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 RecordBackType& /* recordingMeta */)>
  Func_void_RecordBackType create_Func_void_RecordBackType(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = NitroSound::Func_void_RecordBackType::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const RecordBackType& recordingMeta) mutable -> void {
      swiftClosure.call(recordingMeta);
    };
  }
  
  // pragma MARK: std::function<void(const PlayBackType& /* playbackMeta */)>
  Func_void_PlayBackType create_Func_void_PlayBackType(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = NitroSound::Func_void_PlayBackType::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const PlayBackType& playbackMeta) mutable -> void {
      swiftClosure.call(playbackMeta);
    };
  }
  
  // pragma MARK: std::function<void(const PlaybackEndType& /* playbackEndMeta */)>
  Func_void_PlaybackEndType create_Func_void_PlaybackEndType(void* NON_NULL swiftClosureWrapper) noexcept {
    auto swiftClosure = NitroSound::Func_void_PlaybackEndType::fromUnsafe(swiftClosureWrapper);
    return [swiftClosure = std::move(swiftClosure)](const PlaybackEndType& playbackEndMeta) mutable -> void {
      swiftClosure.call(playbackEndMeta);
    };
  }
  
  // pragma MARK: std::shared_ptr<HybridSoundSpec>
  std::shared_ptr<HybridSoundSpec> create_std__shared_ptr_HybridSoundSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
    NitroSound::HybridSoundSpec_cxx swiftPart = NitroSound::HybridSoundSpec_cxx::fromUnsafe(swiftUnsafePointer);
    return std::make_shared<margelo::nitro::sound::HybridSoundSpecSwift>(swiftPart);
  }
  void* NON_NULL get_std__shared_ptr_HybridSoundSpec_(std__shared_ptr_HybridSoundSpec_ cppType) {
    std::shared_ptr<margelo::nitro::sound::HybridSoundSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::sound::HybridSoundSpecSwift>(cppType);
    #ifdef NITRO_DEBUG
    if (swiftWrapper == nullptr) [[unlikely]] {
      throw std::runtime_error("Class \"HybridSoundSpec\" is not implemented in Swift!");
    }
    #endif
    NitroSound::HybridSoundSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
    return swiftPart.toUnsafe();
  }

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