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

#pragma once

#include "HybridOneDataScannerSpec.hpp"

// Forward declaration of `HybridOneDataScannerSpec_cxx` to properly resolve imports.
namespace One { class HybridOneDataScannerSpec_cxx; }

// Forward declaration of `DataScannerRect` to properly resolve imports.
namespace margelo::nitro::one { struct DataScannerRect; }
// Forward declaration of `DataScannerConfiguration` to properly resolve imports.
namespace margelo::nitro::one { struct DataScannerConfiguration; }
// Forward declaration of `DataScannerRecognizedDataType` to properly resolve imports.
namespace margelo::nitro::one { struct DataScannerRecognizedDataType; }
// Forward declaration of `DataScannerItemType` to properly resolve imports.
namespace margelo::nitro::one { enum class DataScannerItemType; }
// Forward declaration of `DataScannerTextContentType` to properly resolve imports.
namespace margelo::nitro::one { enum class DataScannerTextContentType; }
// Forward declaration of `DataScannerQualityLevel` to properly resolve imports.
namespace margelo::nitro::one { enum class DataScannerQualityLevel; }
// Forward declaration of `DataScannerRecognizedItem` to properly resolve imports.
namespace margelo::nitro::one { struct DataScannerRecognizedItem; }
// Forward declaration of `DataScannerBounds` to properly resolve imports.
namespace margelo::nitro::one { struct DataScannerBounds; }
// Forward declaration of `DataScannerPoint` to properly resolve imports.
namespace margelo::nitro::one { struct DataScannerPoint; }
// Forward declaration of `DataScannerScanningUnavailable` to properly resolve imports.
namespace margelo::nitro::one { enum class DataScannerScanningUnavailable; }
// Forward declaration of `HybridDocumentCameraImageSpec` to properly resolve imports.
namespace margelo::nitro::one { class HybridDocumentCameraImageSpec; }

#include <string>
#include <vector>
#include "DataScannerRect.hpp"
#include <optional>
#include "DataScannerConfiguration.hpp"
#include "DataScannerRecognizedDataType.hpp"
#include "DataScannerItemType.hpp"
#include "DataScannerTextContentType.hpp"
#include "DataScannerQualityLevel.hpp"
#include <functional>
#include "DataScannerRecognizedItem.hpp"
#include "DataScannerBounds.hpp"
#include "DataScannerPoint.hpp"
#include "DataScannerScanningUnavailable.hpp"
#include <NitroModules/Promise.hpp>
#include <memory>
#include "HybridDocumentCameraImageSpec.hpp"

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

namespace margelo::nitro::one {

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

  public:
    // Get the Swift part
    inline One::HybridOneDataScannerSpec_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<HybridOneDataScannerSpecSwift>(other)) {
        return _swiftPart.equals(otherCast->_swiftPart);
      }
      return false;
    }
    void dispose() noexcept override {
      _swiftPart.dispose();
    }
    std::string toString() override {
      return _swiftPart.toString();
    }

  public:
    // Properties
    inline bool getIsSupported() noexcept override {
      return _swiftPart.isSupported();
    }
    inline bool getIsAvailable() noexcept override {
      return _swiftPart.isAvailable();
    }
    inline std::vector<std::string> getSupportedTextRecognitionLanguages() noexcept override {
      auto __result = _swiftPart.getSupportedTextRecognitionLanguages();
      return __result;
    }
    inline std::optional<DataScannerRect> getRegionOfInterest() noexcept override {
      auto __result = _swiftPart.getRegionOfInterest();
      return __result;
    }
    inline void setRegionOfInterest(const std::optional<DataScannerRect>& regionOfInterest) noexcept override {
      _swiftPart.setRegionOfInterest(regionOfInterest);
    }
    inline bool getIsScanning() noexcept override {
      return _swiftPart.isScanning();
    }
    inline double getZoomFactor() noexcept override {
      return _swiftPart.getZoomFactor();
    }
    inline void setZoomFactor(double zoomFactor) noexcept override {
      _swiftPart.setZoomFactor(std::forward<decltype(zoomFactor)>(zoomFactor));
    }

  public:
    // Methods
    inline void configure(const DataScannerConfiguration& configuration) override {
      auto __result = _swiftPart.configure(std::forward<decltype(configuration)>(configuration));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void setDelegate(const std::function<void()>& didZoom, const std::function<void(const DataScannerRecognizedItem& /* item */)>& didTapOn, const std::function<void(const std::vector<DataScannerRecognizedItem>& /* items */, const std::vector<DataScannerRecognizedItem>& /* allItems */)>& didAdd, const std::function<void(const std::vector<DataScannerRecognizedItem>& /* items */, const std::vector<DataScannerRecognizedItem>& /* allItems */)>& didUpdate, const std::function<void(const std::vector<DataScannerRecognizedItem>& /* items */, const std::vector<DataScannerRecognizedItem>& /* allItems */)>& didRemove, const std::function<void(DataScannerScanningUnavailable /* error */)>& becameUnavailable) override {
      auto __result = _swiftPart.setDelegate(didZoom, didTapOn, didAdd, didUpdate, didRemove, becameUnavailable);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline double getMinZoomFactor() override {
      auto __result = _swiftPart.getMinZoomFactor();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline double getMaxZoomFactor() override {
      auto __result = _swiftPart.getMaxZoomFactor();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<void>> present(bool animated) override {
      auto __result = _swiftPart.present(std::forward<decltype(animated)>(animated));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<void>> dismiss(bool animated) override {
      auto __result = _swiftPart.dismiss(std::forward<decltype(animated)>(animated));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline void startScanning() override {
      auto __result = _swiftPart.startScanning();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void stopScanning() override {
      auto __result = _swiftPart.stopScanning();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline std::shared_ptr<Promise<std::shared_ptr<HybridDocumentCameraImageSpec>>> capturePhoto() override {
      auto __result = _swiftPart.capturePhoto();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline double subscribeRecognizedItems(const std::function<void(const std::vector<DataScannerRecognizedItem>& /* items */)>& onItems, const std::function<void()>& onEnd) override {
      auto __result = _swiftPart.subscribeRecognizedItems(onItems, onEnd);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline void unsubscribeRecognizedItems(double id) override {
      auto __result = _swiftPart.unsubscribeRecognizedItems(std::forward<decltype(id)>(id));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }

  private:
    One::HybridOneDataScannerSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::one
