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

#pragma once

#include "HybridPreviewViewSpec.hpp"

// Forward declaration of `HybridPreviewViewSpec_cxx` to properly resolve imports.
namespace VisionCamera { class HybridPreviewViewSpec_cxx; }

// Forward declaration of `HybridCameraPreviewOutputSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridCameraPreviewOutputSpec; }
// Forward declaration of `PreviewResizeMode` to properly resolve imports.
namespace margelo::nitro::camera { enum class PreviewResizeMode; }
// Forward declaration of `PreviewImplementationMode` to properly resolve imports.
namespace margelo::nitro::camera { enum class PreviewImplementationMode; }
// Forward declaration of `HybridGestureControllerSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridGestureControllerSpec; }
// Forward declaration of `HybridMeteringPointSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridMeteringPointSpec; }
// Forward declaration of `HybridImageSpec` to properly resolve imports.
namespace margelo::nitro::image { class HybridImageSpec; }
// Forward declaration of `Point` to properly resolve imports.
namespace margelo::nitro::camera { struct Point; }
// Forward declaration of `HybridScannedObjectSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridScannedObjectSpec; }

#include <memory>
#include "HybridCameraPreviewOutputSpec.hpp"
#include <optional>
#include "PreviewResizeMode.hpp"
#include "PreviewImplementationMode.hpp"
#include "HybridGestureControllerSpec.hpp"
#include <vector>
#include <functional>
#include "HybridMeteringPointSpec.hpp"
#include <NitroImage/HybridImageSpec.hpp>
#include <NitroModules/Promise.hpp>
#include "Point.hpp"
#include "HybridScannedObjectSpec.hpp"

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

namespace margelo::nitro::camera {

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

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

  public:
    // Properties
    inline std::optional<std::shared_ptr<HybridCameraPreviewOutputSpec>> getPreviewOutput() noexcept override {
      auto __result = _swiftPart.getPreviewOutput();
      return __result;
    }
    inline void setPreviewOutput(const std::optional<std::shared_ptr<HybridCameraPreviewOutputSpec>>& previewOutput) noexcept override {
      _swiftPart.setPreviewOutput(previewOutput);
    }
    inline std::optional<PreviewResizeMode> getResizeMode() noexcept override {
      auto __result = _swiftPart.getResizeMode();
      return __result;
    }
    inline void setResizeMode(std::optional<PreviewResizeMode> resizeMode) noexcept override {
      _swiftPart.setResizeMode(resizeMode);
    }
    inline std::optional<PreviewImplementationMode> getImplementationMode() noexcept override {
      auto __result = _swiftPart.getImplementationMode();
      return __result;
    }
    inline void setImplementationMode(std::optional<PreviewImplementationMode> implementationMode) noexcept override {
      _swiftPart.setImplementationMode(implementationMode);
    }
    inline std::optional<std::vector<std::shared_ptr<HybridGestureControllerSpec>>> getGestureControllers() noexcept override {
      auto __result = _swiftPart.getGestureControllers();
      return __result;
    }
    inline void setGestureControllers(const std::optional<std::vector<std::shared_ptr<HybridGestureControllerSpec>>>& gestureControllers) noexcept override {
      _swiftPart.setGestureControllers(gestureControllers);
    }
    inline std::optional<std::function<void()>> getOnPreviewStarted() noexcept override {
      auto __result = _swiftPart.getOnPreviewStarted();
      return __result;
    }
    inline void setOnPreviewStarted(const std::optional<std::function<void()>>& onPreviewStarted) noexcept override {
      _swiftPart.setOnPreviewStarted(onPreviewStarted);
    }
    inline std::optional<std::function<void()>> getOnPreviewStopped() noexcept override {
      auto __result = _swiftPart.getOnPreviewStopped();
      return __result;
    }
    inline void setOnPreviewStopped(const std::optional<std::function<void()>>& onPreviewStopped) noexcept override {
      _swiftPart.setOnPreviewStopped(onPreviewStopped);
    }

  public:
    // Methods
    inline std::shared_ptr<HybridMeteringPointSpec> createMeteringPoint(double viewX, double viewY, std::optional<double> size) override {
      auto __result = _swiftPart.createMeteringPoint(std::forward<decltype(viewX)>(viewX), std::forward<decltype(viewY)>(viewY), size);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>> takeSnapshot() override {
      auto __result = _swiftPart.takeSnapshot();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline Point convertCameraPointToViewPoint(const Point& cameraPoint) override {
      auto __result = _swiftPart.convertCameraPointToViewPoint(std::forward<decltype(cameraPoint)>(cameraPoint));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline Point convertViewPointToCameraPoint(const Point& viewPoint) override {
      auto __result = _swiftPart.convertViewPointToCameraPoint(std::forward<decltype(viewPoint)>(viewPoint));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<HybridScannedObjectSpec> convertScannedObjectCoordinatesToViewCoordinates(const std::shared_ptr<HybridScannedObjectSpec>& scannedObject) override {
      auto __result = _swiftPart.convertScannedObjectCoordinatesToViewCoordinates(scannedObject);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    VisionCamera::HybridPreviewViewSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::camera
