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

import NitroModules

/// See ``HybridCameraSessionSpec``
public protocol HybridCameraSessionSpec_protocol: HybridObject {
  // Properties
  var isRunning: Bool { get }

  // Methods
  func configure(connections: [CameraSessionConnection], config: CameraSessionConfiguration?) throws -> Promise<[(any HybridCameraControllerSpec)]>
  func start() throws -> Promise<Void>
  func stop() throws -> Promise<Void>
  func addOnStartedListener(onStarted: @escaping () -> Void) throws -> ListenerSubscription
  func addOnStoppedListener(onStopped: @escaping () -> Void) throws -> ListenerSubscription
  func addOnErrorListener(onError: @escaping (_ error: Error) -> Void) throws -> ListenerSubscription
  func addOnInterruptionStartedListener(onInterruptionStarted: @escaping (_ reason: InterruptionReason) -> Void) throws -> ListenerSubscription
  func addOnInterruptionEndedListener(onInterruptionEnded: @escaping () -> Void) throws -> ListenerSubscription
}

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

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

/**
 * A Swift base-protocol representing the CameraSession HybridObject.
 * Implement this protocol to create Swift-based instances of CameraSession.
 * ```swift
 * class HybridCameraSession : HybridCameraSessionSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridCameraSessionSpec = HybridCameraSessionSpec_protocol & HybridCameraSessionSpec_base
