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

#pragma once

#include "HybridFramePlaneSpec.hpp"

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

// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
namespace NitroModules { class ArrayBufferHolder; }

#include <NitroModules/ArrayBuffer.hpp>
#include <NitroModules/ArrayBufferHolder.hpp>

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

namespace margelo::nitro::camera {

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

  public:
    // Get the Swift part
    inline VisionCamera::HybridFramePlaneSpec_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<HybridFramePlaneSpecSwift>(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 getWidth() noexcept override {
      return _swiftPart.getWidth();
    }
    inline double getHeight() noexcept override {
      return _swiftPart.getHeight();
    }
    inline double getBytesPerRow() noexcept override {
      return _swiftPart.getBytesPerRow();
    }
    inline bool getIsValid() noexcept override {
      return _swiftPart.isValid();
    }

  public:
    // Methods
    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;
    }

  private:
    VisionCamera::HybridFramePlaneSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::camera
