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

#pragma once

#include "HybridBarcodeScannerFactorySpec.hpp"

// Forward declaration of `HybridBarcodeScannerFactorySpec_cxx` to properly resolve imports.
namespace VisionCameraBarcodeScanner { class HybridBarcodeScannerFactorySpec_cxx; }

// Forward declaration of `HybridBarcodeScannerSpec` to properly resolve imports.
namespace margelo::nitro::camera::barcodescanner { class HybridBarcodeScannerSpec; }
// Forward declaration of `BarcodeScannerOptions` to properly resolve imports.
namespace margelo::nitro::camera::barcodescanner { struct BarcodeScannerOptions; }
// Forward declaration of `TargetBarcodeFormat` to properly resolve imports.
namespace margelo::nitro::camera::barcodescanner { enum class TargetBarcodeFormat; }
// Forward declaration of `HybridCameraOutputSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridCameraOutputSpec; }
// Forward declaration of `BarcodeScannerOutputOptions` to properly resolve imports.
namespace margelo::nitro::camera::barcodescanner { struct BarcodeScannerOutputOptions; }
// Forward declaration of `BarcodeScannerOutputResolution` to properly resolve imports.
namespace margelo::nitro::camera::barcodescanner { enum class BarcodeScannerOutputResolution; }
// Forward declaration of `HybridBarcodeSpec` to properly resolve imports.
namespace margelo::nitro::camera::barcodescanner { class HybridBarcodeSpec; }

#include <memory>
#include "HybridBarcodeScannerSpec.hpp"
#include "BarcodeScannerOptions.hpp"
#include "TargetBarcodeFormat.hpp"
#include <vector>
#include <VisionCamera/HybridCameraOutputSpec.hpp>
#include "BarcodeScannerOutputOptions.hpp"
#include "BarcodeScannerOutputResolution.hpp"
#include <optional>
#include "HybridBarcodeSpec.hpp"
#include <functional>
#include <exception>

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

namespace margelo::nitro::camera::barcodescanner {

  /**
   * The C++ part of HybridBarcodeScannerFactorySpec_cxx.swift.
   *
   * HybridBarcodeScannerFactorySpecSwift (C++) accesses HybridBarcodeScannerFactorySpec_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, HybridBarcodeScannerFactorySpec_cxx can directly inherit from the C++ class HybridBarcodeScannerFactorySpec
   * to simplify the whole structure and memory management.
   */
  class HybridBarcodeScannerFactorySpecSwift: public virtual HybridBarcodeScannerFactorySpec {
  public:
    // Constructor from a Swift instance
    explicit HybridBarcodeScannerFactorySpecSwift(const VisionCameraBarcodeScanner::HybridBarcodeScannerFactorySpec_cxx& swiftPart):
      HybridObject(HybridBarcodeScannerFactorySpec::TAG),
      _swiftPart(swiftPart) { }

  public:
    // Get the Swift part
    inline VisionCameraBarcodeScanner::HybridBarcodeScannerFactorySpec_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<HybridBarcodeScannerFactorySpecSwift>(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<HybridBarcodeScannerSpec> createBarcodeScanner(const BarcodeScannerOptions& options) override {
      auto __result = _swiftPart.createBarcodeScanner(std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec> createBarcodeScannerOutput(const BarcodeScannerOutputOptions& options) override {
      auto __result = _swiftPart.createBarcodeScannerOutput(std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    VisionCameraBarcodeScanner::HybridBarcodeScannerFactorySpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::camera::barcodescanner
