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

#pragma once

#include "HybridFrameConverterSpec.hpp"

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

// Forward declaration of `HybridImageSpec` to properly resolve imports.
namespace margelo::nitro::image { class HybridImageSpec; }
// Forward declaration of `HybridFrameSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridFrameSpec; }
// Forward declaration of `HybridDepthSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridDepthSpec; }

#include <memory>
#include <NitroImage/HybridImageSpec.hpp>
#include "HybridFrameSpec.hpp"
#include <NitroModules/Promise.hpp>
#include "HybridDepthSpec.hpp"

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

namespace margelo::nitro::camera {

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

  public:
    // Get the Swift part
    inline VisionCamera::HybridFrameConverterSpec_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<HybridFrameConverterSpecSwift>(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<margelo::nitro::image::HybridImageSpec> convertFrameToImage(const std::shared_ptr<HybridFrameSpec>& frame) override {
      auto __result = _swiftPart.convertFrameToImage(frame);
      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>>> convertFrameToImageAsync(const std::shared_ptr<HybridFrameSpec>& frame) override {
      auto __result = _swiftPart.convertFrameToImageAsync(frame);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<margelo::nitro::image::HybridImageSpec> convertDepthToImage(const std::shared_ptr<HybridDepthSpec>& depth) override {
      auto __result = _swiftPart.convertDepthToImage(depth);
      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>>> convertDepthToImageAsync(const std::shared_ptr<HybridDepthSpec>& depth) override {
      auto __result = _swiftPart.convertDepthToImageAsync(depth);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    VisionCamera::HybridFrameConverterSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::camera
