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

#pragma once

#include "HybridCameraDeviceFactorySpec.hpp"

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

// Forward declaration of `HybridCameraDeviceSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridCameraDeviceSpec; }
// Forward declaration of `ListenerSubscription` to properly resolve imports.
namespace margelo::nitro::camera { struct ListenerSubscription; }
// Forward declaration of `HybridCameraExtensionSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridCameraExtensionSpec; }
// Forward declaration of `CameraPosition` to properly resolve imports.
namespace margelo::nitro::camera { enum class CameraPosition; }

#include <memory>
#include "HybridCameraDeviceSpec.hpp"
#include <vector>
#include <optional>
#include "ListenerSubscription.hpp"
#include <functional>
#include <string>
#include "HybridCameraExtensionSpec.hpp"
#include <NitroModules/Promise.hpp>
#include "CameraPosition.hpp"

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

namespace margelo::nitro::camera {

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

  public:
    // Get the Swift part
    inline VisionCamera::HybridCameraDeviceFactorySpec_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<HybridCameraDeviceFactorySpecSwift>(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::vector<std::shared_ptr<HybridCameraDeviceSpec>> getCameraDevices() noexcept override {
      auto __result = _swiftPart.getCameraDevices();
      return __result;
    }
    inline std::optional<std::shared_ptr<HybridCameraDeviceSpec>> getUserPreferredCamera() noexcept override {
      auto __result = _swiftPart.getUserPreferredCamera();
      return __result;
    }
    inline void setUserPreferredCamera(const std::optional<std::shared_ptr<HybridCameraDeviceSpec>>& userPreferredCamera) noexcept override {
      _swiftPart.setUserPreferredCamera(userPreferredCamera);
    }
    inline std::vector<std::vector<std::shared_ptr<HybridCameraDeviceSpec>>> getSupportedMultiCamDeviceCombinations() noexcept override {
      auto __result = _swiftPart.getSupportedMultiCamDeviceCombinations();
      return __result;
    }

  public:
    // Methods
    inline ListenerSubscription addOnCameraDevicesChangedListener(const std::function<void(const std::vector<std::shared_ptr<HybridCameraDeviceSpec>>& /* newDevices */)>& listener) override {
      auto __result = _swiftPart.addOnCameraDevicesChangedListener(listener);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridCameraDeviceSpec>> getCameraForId(const std::string& id) override {
      auto __result = _swiftPart.getCameraForId(id);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::vector<std::shared_ptr<HybridCameraExtensionSpec>>>> getSupportedExtensions(const std::shared_ptr<HybridCameraDeviceSpec>& camera) override {
      auto __result = _swiftPart.getSupportedExtensions(camera);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridCameraDeviceSpec>> getDefaultCamera(CameraPosition position) override {
      auto __result = _swiftPart.getDefaultCamera(static_cast<int>(position));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    VisionCamera::HybridCameraDeviceFactorySpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::camera
