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

#pragma once

#include "HybridDataScannerFactorySpec.hpp"

// Forward declaration of `HybridDataScannerFactorySpec_cxx` to properly resolve imports.
namespace NitroDataScanner { class HybridDataScannerFactorySpec_cxx; }

// Forward declaration of `ScannedBarcode` to properly resolve imports.
namespace margelo::nitro::datascanner { struct ScannedBarcode; }
// Forward declaration of `BarcodeFormat` to properly resolve imports.
namespace margelo::nitro::datascanner { enum class BarcodeFormat; }
// Forward declaration of `ScanBarcodeOptions` to properly resolve imports.
namespace margelo::nitro::datascanner { struct ScanBarcodeOptions; }
// Forward declaration of `TargetBarcodeFormat` to properly resolve imports.
namespace margelo::nitro::datascanner { enum class TargetBarcodeFormat; }
// Forward declaration of `ScanQualityLevel` to properly resolve imports.
namespace margelo::nitro::datascanner { enum class ScanQualityLevel; }

#include "ScannedBarcode.hpp"
#include <NitroModules/Promise.hpp>
#include <string>
#include "BarcodeFormat.hpp"
#include "ScanBarcodeOptions.hpp"
#include <optional>
#include "TargetBarcodeFormat.hpp"
#include <vector>
#include "ScanQualityLevel.hpp"

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

namespace margelo::nitro::datascanner {

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

  public:
    // Get the Swift part
    inline NitroDataScanner::HybridDataScannerFactorySpec_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<HybridDataScannerFactorySpecSwift>(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<Promise<ScannedBarcode>> scanBarcode(const std::optional<ScanBarcodeOptions>& options) override {
      auto __result = _swiftPart.scanBarcode(options);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    NitroDataScanner::HybridDataScannerFactorySpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::datascanner
