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

import Foundation
import NitroModules

/// See ``HybridVideoPlayerSpec``
public protocol HybridVideoPlayerSpec_protocol: HybridObject {
  // Properties
  var source: (any HybridVideoPlayerSourceSpec) { get }
  var eventEmitter: (any HybridVideoPlayerEventEmitterSpec) { get }
  var status: VideoPlayerStatus { get }
  var duration: Double { get }
  var volume: Double { get set }
  var currentTime: Double { get set }
  var muted: Bool { get set }
  var loop: Bool { get set }
  var rate: Double { get set }
  var mixAudioMode: MixAudioMode { get set }
  var ignoreSilentSwitchMode: IgnoreSilentSwitchMode { get set }
  var playInBackground: Bool { get set }
  var playWhenInactive: Bool { get set }
  var isPlaying: Bool { get }
  var selectedTrack: TextTrack? { get }

  // Methods
  func replaceSourceAsync(source: (any HybridVideoPlayerSourceSpec)?) throws -> Promise<Void>
  func getAvailableTextTracks() throws -> [TextTrack]
  func selectTextTrack(textTrack: TextTrack?) throws -> Void
  func initialize() throws -> Promise<Void>
  func preload() throws -> Promise<Void>
  func play() throws -> Void
  func pause() throws -> Void
  func seekBy(time: Double) throws -> Void
  func seekTo(time: Double) throws -> Void
}

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

/**
 * A Swift base-protocol representing the VideoPlayer HybridObject.
 * Implement this protocol to create Swift-based instances of VideoPlayer.
 * ```swift
 * class HybridVideoPlayer : HybridVideoPlayerSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridVideoPlayerSpec = HybridVideoPlayerSpec_protocol & HybridVideoPlayerSpec_base
