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

#pragma once

#include "HybridFrameSpec.hpp"

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

// Forward declaration of `PixelFormat` to properly resolve imports.
namespace margelo::nitro::camera { enum class PixelFormat; }
// Forward declaration of `CameraOrientation` to properly resolve imports.
namespace margelo::nitro::camera { enum class CameraOrientation; }
// Forward declaration of `HybridFramePlaneSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridFramePlaneSpec; }
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
namespace NitroModules { class ArrayBufferHolder; }
// Forward declaration of `NativeBuffer` to properly resolve imports.
namespace margelo::nitro::camera { struct NativeBuffer; }
// Forward declaration of `Point` to properly resolve imports.
namespace margelo::nitro::camera { struct Point; }

#include "PixelFormat.hpp"
#include "CameraOrientation.hpp"
#include <vector>
#include <optional>
#include <memory>
#include "HybridFramePlaneSpec.hpp"
#include <NitroModules/ArrayBuffer.hpp>
#include <NitroModules/ArrayBufferHolder.hpp>
#include "NativeBuffer.hpp"
#include <functional>
#include "Point.hpp"

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

namespace margelo::nitro::camera {

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

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

  public:
    // Properties
    inline double getTimestamp() noexcept override {
      return _swiftPart.getTimestamp();
    }
    inline bool getIsValid() noexcept override {
      return _swiftPart.isValid();
    }
    inline double getWidth() noexcept override {
      return _swiftPart.getWidth();
    }
    inline double getHeight() noexcept override {
      return _swiftPart.getHeight();
    }
    inline double getBytesPerRow() noexcept override {
      return _swiftPart.getBytesPerRow();
    }
    inline PixelFormat getPixelFormat() noexcept override {
      auto __result = _swiftPart.getPixelFormat();
      return static_cast<PixelFormat>(__result);
    }
    inline CameraOrientation getOrientation() noexcept override {
      auto __result = _swiftPart.getOrientation();
      return static_cast<CameraOrientation>(__result);
    }
    inline bool getIsMirrored() noexcept override {
      return _swiftPart.isMirrored();
    }
    inline bool getIsPlanar() noexcept override {
      return _swiftPart.isPlanar();
    }
    inline bool getHasPixelBuffer() noexcept override {
      return _swiftPart.hasPixelBuffer();
    }
    inline bool getHasNativeBuffer() noexcept override {
      return _swiftPart.hasNativeBuffer();
    }
    inline std::optional<std::vector<double>> getCameraIntrinsicMatrix() noexcept override {
      auto __result = _swiftPart.getCameraIntrinsicMatrix();
      return __result;
    }

  public:
    // Methods
    inline std::vector<std::shared_ptr<HybridFramePlaneSpec>> getPlanes() override {
      auto __result = _swiftPart.getPlanes();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<ArrayBuffer> getPixelBuffer() override {
      auto __result = _swiftPart.getPixelBuffer();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline NativeBuffer getNativeBuffer() override {
      auto __result = _swiftPart.getNativeBuffer();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline Point convertCameraPointToFramePoint(const Point& cameraPoint) override {
      auto __result = _swiftPart.convertCameraPointToFramePoint(std::forward<decltype(cameraPoint)>(cameraPoint));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline Point convertFramePointToCameraPoint(const Point& framePoint) override {
      auto __result = _swiftPart.convertFramePointToCameraPoint(std::forward<decltype(framePoint)>(framePoint));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    VisionCamera::HybridFrameSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::camera
