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

#pragma once

// Forward declarations of C++ defined types
// Forward declaration of `DfuError` to properly resolve imports.
namespace margelo::nitro::co::zyke::dfu { enum class DfuError; }
// Forward declaration of `DfuFirmwareType` to properly resolve imports.
namespace margelo::nitro::co::zyke::dfu { enum class DfuFirmwareType; }
// Forward declaration of `DfuState` to properly resolve imports.
namespace margelo::nitro::co::zyke::dfu { enum class DfuState; }
// Forward declaration of `HybridNativeDfuNitroSpec` to properly resolve imports.
namespace margelo::nitro::co::zyke::dfu { class HybridNativeDfuNitroSpec; }

// Forward declarations of Swift defined types
// Forward declaration of `HybridNativeDfuNitroSpec_cxx` to properly resolve imports.
namespace NitroDfu { class HybridNativeDfuNitroSpec_cxx; }

// Include C++ defined types
#include "DfuError.hpp"
#include "DfuFirmwareType.hpp"
#include "DfuState.hpp"
#include "HybridNativeDfuNitroSpec.hpp"
#include <NitroModules/Result.hpp>
#include <exception>
#include <functional>
#include <memory>
#include <optional>
#include <string>

/**
 * Contains specialized versions of C++ templated types so they can be accessed from Swift,
 * as well as helper functions to interact with those C++ types from Swift.
 */
namespace margelo::nitro::co::zyke::dfu::bridge::swift {

  // pragma MARK: std::optional<DfuFirmwareType>
  /**
   * Specialized version of `std::optional<DfuFirmwareType>`.
   */
  using std__optional_DfuFirmwareType_ = std::optional<DfuFirmwareType>;
  inline std::optional<DfuFirmwareType> create_std__optional_DfuFirmwareType_(const DfuFirmwareType& value) noexcept {
    return std::optional<DfuFirmwareType>(value);
  }
  inline bool has_value_std__optional_DfuFirmwareType_(const std::optional<DfuFirmwareType>& optional) noexcept {
    return optional.has_value();
  }
  inline DfuFirmwareType get_std__optional_DfuFirmwareType_(const std::optional<DfuFirmwareType>& optional) noexcept {
    return optional.value();
  }
  
  // pragma MARK: std::optional<double>
  /**
   * Specialized version of `std::optional<double>`.
   */
  using std__optional_double_ = std::optional<double>;
  inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
    return std::optional<double>(value);
  }
  inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
    return optional.has_value();
  }
  inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
    return optional.value();
  }
  
  // pragma MARK: std::optional<bool>
  /**
   * Specialized version of `std::optional<bool>`.
   */
  using std__optional_bool_ = std::optional<bool>;
  inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
    return std::optional<bool>(value);
  }
  inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
    return optional.has_value();
  }
  inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
    return optional.value();
  }
  
  // pragma MARK: std::function<void(DfuState /* state */)>
  /**
   * Specialized version of `std::function<void(DfuState)>`.
   */
  using Func_void_DfuState = std::function<void(DfuState /* state */)>;
  /**
   * Wrapper class for a `std::function<void(DfuState / * state * /)>`, this can be used from Swift.
   */
  class Func_void_DfuState_Wrapper final {
  public:
    explicit Func_void_DfuState_Wrapper(std::function<void(DfuState /* state */)>&& func): _function(std::make_unique<std::function<void(DfuState /* state */)>>(std::move(func))) {}
    inline void call(int state) const noexcept {
      _function->operator()(static_cast<DfuState>(state));
    }
  private:
    std::unique_ptr<std::function<void(DfuState /* state */)>> _function;
  } SWIFT_NONCOPYABLE;
  Func_void_DfuState create_Func_void_DfuState(void* NON_NULL swiftClosureWrapper) noexcept;
  inline Func_void_DfuState_Wrapper wrap_Func_void_DfuState(Func_void_DfuState value) noexcept {
    return Func_void_DfuState_Wrapper(std::move(value));
  }
  
  // pragma MARK: std::function<void(double /* part */, double /* totalParts */, double /* progress */, double /* currentSpeed */, double /* avgSpeed */)>
  /**
   * Specialized version of `std::function<void(double, double, double, double, double)>`.
   */
  using Func_void_double_double_double_double_double = std::function<void(double /* part */, double /* totalParts */, double /* progress */, double /* currentSpeed */, double /* avgSpeed */)>;
  /**
   * Wrapper class for a `std::function<void(double / * part * /, double / * totalParts * /, double / * progress * /, double / * currentSpeed * /, double / * avgSpeed * /)>`, this can be used from Swift.
   */
  class Func_void_double_double_double_double_double_Wrapper final {
  public:
    explicit Func_void_double_double_double_double_double_Wrapper(std::function<void(double /* part */, double /* totalParts */, double /* progress */, double /* currentSpeed */, double /* avgSpeed */)>&& func): _function(std::make_unique<std::function<void(double /* part */, double /* totalParts */, double /* progress */, double /* currentSpeed */, double /* avgSpeed */)>>(std::move(func))) {}
    inline void call(double part, double totalParts, double progress, double currentSpeed, double avgSpeed) const noexcept {
      _function->operator()(part, totalParts, progress, currentSpeed, avgSpeed);
    }
  private:
    std::unique_ptr<std::function<void(double /* part */, double /* totalParts */, double /* progress */, double /* currentSpeed */, double /* avgSpeed */)>> _function;
  } SWIFT_NONCOPYABLE;
  Func_void_double_double_double_double_double create_Func_void_double_double_double_double_double(void* NON_NULL swiftClosureWrapper) noexcept;
  inline Func_void_double_double_double_double_double_Wrapper wrap_Func_void_double_double_double_double_double(Func_void_double_double_double_double_double value) noexcept {
    return Func_void_double_double_double_double_double_Wrapper(std::move(value));
  }
  
  // pragma MARK: std::function<void(DfuError /* error */, const std::string& /* message */)>
  /**
   * Specialized version of `std::function<void(DfuError, const std::string&)>`.
   */
  using Func_void_DfuError_std__string = std::function<void(DfuError /* error */, const std::string& /* message */)>;
  /**
   * Wrapper class for a `std::function<void(DfuError / * error * /, const std::string& / * message * /)>`, this can be used from Swift.
   */
  class Func_void_DfuError_std__string_Wrapper final {
  public:
    explicit Func_void_DfuError_std__string_Wrapper(std::function<void(DfuError /* error */, const std::string& /* message */)>&& func): _function(std::make_unique<std::function<void(DfuError /* error */, const std::string& /* message */)>>(std::move(func))) {}
    inline void call(int error, std::string message) const noexcept {
      _function->operator()(static_cast<DfuError>(error), message);
    }
  private:
    std::unique_ptr<std::function<void(DfuError /* error */, const std::string& /* message */)>> _function;
  } SWIFT_NONCOPYABLE;
  Func_void_DfuError_std__string create_Func_void_DfuError_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
  inline Func_void_DfuError_std__string_Wrapper wrap_Func_void_DfuError_std__string(Func_void_DfuError_std__string value) noexcept {
    return Func_void_DfuError_std__string_Wrapper(std::move(value));
  }
  
  // pragma MARK: std::shared_ptr<HybridNativeDfuNitroSpec>
  /**
   * Specialized version of `std::shared_ptr<HybridNativeDfuNitroSpec>`.
   */
  using std__shared_ptr_HybridNativeDfuNitroSpec_ = std::shared_ptr<HybridNativeDfuNitroSpec>;
  std::shared_ptr<HybridNativeDfuNitroSpec> create_std__shared_ptr_HybridNativeDfuNitroSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
  void* NON_NULL get_std__shared_ptr_HybridNativeDfuNitroSpec_(std__shared_ptr_HybridNativeDfuNitroSpec_ cppType);
  
  // pragma MARK: std::weak_ptr<HybridNativeDfuNitroSpec>
  using std__weak_ptr_HybridNativeDfuNitroSpec_ = std::weak_ptr<HybridNativeDfuNitroSpec>;
  inline std__weak_ptr_HybridNativeDfuNitroSpec_ weakify_std__shared_ptr_HybridNativeDfuNitroSpec_(const std::shared_ptr<HybridNativeDfuNitroSpec>& strong) noexcept { return strong; }
  
  // pragma MARK: Result<void>
  using Result_void_ = Result<void>;
  inline Result_void_ create_Result_void_() noexcept {
    return Result<void>::withValue();
  }
  inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
    return Result<void>::withError(error);
  }

} // namespace margelo::nitro::co::zyke::dfu::bridge::swift
