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

import NitroModules

/// See ``HybridVideoViewSpec``
public protocol HybridVideoViewSpec_protocol: HybridObject, HybridView {
  // Properties
  var resizeMode: ResizeMode { get set }
  var pipEnabled: Bool { get set }
  var playInBackground: Bool { get set }
  var onPipStart: () -> Void { get set }
  var onPipStop: () -> Void { get set }
  var surfaceType: SurfaceType { get set }
  var onFullscreenEnter: () -> Void { get set }
  var onFullscreenExit: () -> Void { get set }
  var selectedVideoTrack: VideoTrackSelection { get set }
  var selectedSubtitleTrack: SubtitleTrackSelection { get set }
  var selectedAudioTrack: AudioTrackSelection { get set }
  var adTagUrl: String { get set }
  var source: VideoSource { get set }
  var autoPlay: Bool { get set }

  // Methods
  func attachEngine(engine: (any HybridPlaybackEngineSpec)) throws -> Void
  func detachEngine() throws -> Void
  func startPictureInPicture() throws -> Void
  func stopPictureInPicture() throws -> Void
  func enterFullscreen(config: FullscreenConfig?) throws -> Void
  func exitFullscreen() throws -> Void
  func isFullscreen() throws -> Bool
  func enterNativeFullscreen() throws -> Void
  func applyVideoTrack(selection: VideoTrackSelection) throws -> Void
  func applySubtitleTrack(selection: SubtitleTrackSelection) throws -> Void
  func applyAudioTrack(selection: AudioTrackSelection) throws -> Void
}

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

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

/**
 * A Swift base-protocol representing the VideoView HybridObject.
 * Implement this protocol to create Swift-based instances of VideoView.
 * ```swift
 * class HybridVideoView : HybridVideoViewSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridVideoViewSpec = HybridVideoViewSpec_protocol & HybridVideoViewSpec_base
