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

import NitroModules

/// See ``HybridOneAudioSpec``
public protocol HybridOneAudioSpec_protocol: HybridObject {
  // Properties
  

  // Methods
  func getRecordingPermissionStatus() throws -> Promise<AudioRecordingPermission>
  func requestRecordingPermission() throws -> Promise<AudioRecordingPermission>
  func play(uri: String) throws -> Promise<AudioPlaybackStatus>
  func getPlaybackStatus() throws -> Promise<AudioPlaybackStatus>
  func pause() throws -> Promise<AudioPlaybackStatus>
  func resume() throws -> Promise<AudioPlaybackStatus>
  func seek(positionMs: Double) throws -> Promise<AudioPlaybackStatus>
  func stop() throws -> Promise<Void>
  func startRecording() throws -> Promise<AudioRecordingStatus>
  func getRecordingStatus() throws -> Promise<AudioRecordingStatus>
  func pauseRecording() throws -> Promise<AudioRecordingStatus>
  func resumeRecording() throws -> Promise<AudioRecordingStatus>
  func stopRecording() throws -> Promise<AudioRecordingResult>
  func addInterruptionListener(onEvent: @escaping (_ event: AudioInterruptionEvent) -> Void) throws -> () -> Void
  func setNowPlayingInfo(info: AudioNowPlayingInfo) throws -> Promise<Void>
  func clearNowPlayingInfo() throws -> Promise<Void>
  func addRemoteCommandListener(onEvent: @escaping (_ event: AudioRemoteCommandEvent) -> Void) throws -> () -> Void
  func createPlayer(sourceUri: String?, headers: Dictionary<String, String>?) throws -> String
  func playerPlay(playerId: String) throws -> Void
  func playerPause(playerId: String) throws -> Void
  func playerSeek(playerId: String, seconds: Double, toleranceBeforeMs: Double?, toleranceAfterMs: Double?) throws -> Promise<Void>
  func playerReplace(playerId: String, sourceUri: String?, headers: Dictionary<String, String>?) throws -> Void
  func removePlayer(playerId: String) throws -> Void
  func getPlayerStatus(playerId: String) throws -> AudioPlayerStatus
  func setPlayerRate(playerId: String, rate: Double, pitchQuality: PitchCorrectionQuality?) throws -> Void
  func setPlayerVolume(playerId: String, volume: Double) throws -> Void
  func setPlayerMuted(playerId: String, muted: Bool) throws -> Void
  func setPlayerLoop(playerId: String, loop: Bool) throws -> Void
  func setPlayerPitchCorrection(playerId: String, enabled: Bool) throws -> Void
}

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

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

/**
 * A Swift base-protocol representing the OneAudio HybridObject.
 * Implement this protocol to create Swift-based instances of OneAudio.
 * ```swift
 * class HybridOneAudio : HybridOneAudioSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridOneAudioSpec = HybridOneAudioSpec_protocol & HybridOneAudioSpec_base
