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

import Foundation
import NitroModules

/// See ``HybridSTTSpec``
public protocol HybridSTTSpec_protocol: HybridObject {
  // Properties
  var isLoaded: Bool { get }
  var isTranscribing: Bool { get }
  var isListening: Bool { get }
  var modelId: String { get }

  // Methods
  func load(modelId: String, options: STTLoadOptions?) throws -> Promise<Void>
  func transcribe(audio: ArrayBuffer) throws -> Promise<String>
  func transcribeStream(audio: ArrayBuffer, onToken: @escaping (_ token: String) -> Void) throws -> Promise<String>
  func startListening() throws -> Promise<Void>
  func transcribeBuffer() throws -> Promise<String>
  func stopListening() throws -> Promise<String>
  func stop() throws -> Void
  func unload() throws -> Void
}

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

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

/**
 * A Swift base-protocol representing the STT HybridObject.
 * Implement this protocol to create Swift-based instances of STT.
 * ```swift
 * class HybridSTT : HybridSTTSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridSTTSpec = HybridSTTSpec_protocol & HybridSTTSpec_base
