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

#pragma once

#include "HybridImageFaceDetectorFactorySpec.hpp"

// Forward declaration of `HybridImageFaceDetectorFactorySpec_cxx` to properly resolve imports.
namespace VisionCameraFaceDetector { class HybridImageFaceDetectorFactorySpec_cxx; }

// Forward declaration of `HybridImageFaceDetectorSpec` to properly resolve imports.
namespace margelo::nitro::camera::facedetector { class HybridImageFaceDetectorSpec; }
// Forward declaration of `ImageFaceDetectorOptions` to properly resolve imports.
namespace margelo::nitro::camera::facedetector { struct ImageFaceDetectorOptions; }
// Forward declaration of `PerformanceMode` to properly resolve imports.
namespace margelo::nitro::camera::facedetector { enum class PerformanceMode; }

#include <memory>
#include "HybridImageFaceDetectorSpec.hpp"
#include "ImageFaceDetectorOptions.hpp"
#include "PerformanceMode.hpp"
#include <optional>

#include "VisionCameraFaceDetector-Swift-Cxx-Umbrella.hpp"

namespace margelo::nitro::camera::facedetector {

  /**
   * The C++ part of HybridImageFaceDetectorFactorySpec_cxx.swift.
   *
   * HybridImageFaceDetectorFactorySpecSwift (C++) accesses HybridImageFaceDetectorFactorySpec_cxx (Swift), and might
   * contain some additional bridging code for C++ <> Swift interop.
   *
   * Since this obviously introduces an overhead, I hope at some point in
   * the future, HybridImageFaceDetectorFactorySpec_cxx can directly inherit from the C++ class HybridImageFaceDetectorFactorySpec
   * to simplify the whole structure and memory management.
   */
  class HybridImageFaceDetectorFactorySpecSwift: public virtual HybridImageFaceDetectorFactorySpec {
  public:
    // Constructor from a Swift instance
    explicit HybridImageFaceDetectorFactorySpecSwift(const VisionCameraFaceDetector::HybridImageFaceDetectorFactorySpec_cxx& swiftPart):
      HybridObject(HybridImageFaceDetectorFactorySpec::TAG),
      _swiftPart(swiftPart) { }

  public:
    // Get the Swift part
    inline VisionCameraFaceDetector::HybridImageFaceDetectorFactorySpec_cxx& getSwiftPart() noexcept {
      return _swiftPart;
    }

  public:
    inline size_t getExternalMemorySize() noexcept override {
      return _swiftPart.getMemorySize();
    }
    bool equals(const std::shared_ptr<HybridObject>& other) override {
      if (auto otherCast = std::dynamic_pointer_cast<HybridImageFaceDetectorFactorySpecSwift>(other)) {
        return _swiftPart.equals(otherCast->_swiftPart);
      }
      return false;
    }
    void dispose() noexcept override {
      _swiftPart.dispose();
    }
    std::string toString() override {
      return _swiftPart.toString();
    }

  public:
    // Properties
    

  public:
    // Methods
    inline std::shared_ptr<HybridImageFaceDetectorSpec> createImageFaceDetector(const ImageFaceDetectorOptions& options) override {
      auto __result = _swiftPart.createImageFaceDetector(std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    VisionCameraFaceDetector::HybridImageFaceDetectorFactorySpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::camera::facedetector
