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

import NitroModules

/// See ``HybridFrameSpec``
public protocol HybridFrameSpec_protocol: HybridObject {
  // Properties
  var timestamp: Double { get }
  var isValid: Bool { get }
  var width: Double { get }
  var height: Double { get }
  var bytesPerRow: Double { get }
  var pixelFormat: PixelFormat { get }
  var orientation: CameraOrientation { get }
  var isMirrored: Bool { get }
  var isPlanar: Bool { get }
  var hasPixelBuffer: Bool { get }
  var hasNativeBuffer: Bool { get }
  var cameraIntrinsicMatrix: [Double]? { get }

  // Methods
  func getPlanes() throws -> [(any HybridFramePlaneSpec)]
  func getPixelBuffer() throws -> ArrayBuffer
  func getNativeBuffer() throws -> NativeBuffer
  func convertCameraPointToFramePoint(cameraPoint: Point) throws -> Point
  func convertFramePointToCameraPoint(framePoint: Point) throws -> Point
}

public extension HybridFrameSpec_protocol {
  /// Default implementation of ``HybridObject.toString``
  func toString() -> String {
    return "[HybridObject Frame]"
  }
}

/// See ``HybridFrameSpec``
open class HybridFrameSpec_base {
  private weak var cxxWrapper: HybridFrameSpec_cxx? = nil
  public init() { }
  public func getCxxWrapper() -> HybridFrameSpec_cxx {
  #if DEBUG
    guard self is any HybridFrameSpec else {
      fatalError("`self` is not a `HybridFrameSpec`! Did you accidentally inherit from `HybridFrameSpec_base` instead of `HybridFrameSpec`?")
    }
  #endif
    if let cxxWrapper = self.cxxWrapper {
      return cxxWrapper
    } else {
      let cxxWrapper = HybridFrameSpec_cxx(self as! any HybridFrameSpec)
      self.cxxWrapper = cxxWrapper
      return cxxWrapper
    }
  }
}

/**
 * A Swift base-protocol representing the Frame HybridObject.
 * Implement this protocol to create Swift-based instances of Frame.
 * ```swift
 * class HybridFrame : HybridFrameSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridFrameSpec = HybridFrameSpec_protocol & HybridFrameSpec_base
