///
/// HybridTTSSpec.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 ``HybridTTSSpec``
public protocol HybridTTSSpec_protocol: HybridObject {
  // Properties
  var isLoaded: Bool { get }
  var isGenerating: Bool { get }
  var modelId: String { get }
  var sampleRate: Double { get }

  // Methods
  func load(modelId: String, options: TTSLoadOptions?) throws -> Promise<Void>
  func generate(text: String, options: TTSGenerateOptions?) throws -> Promise<ArrayBuffer>
  func stream(text: String, onAudioChunk: @escaping (_ audio: ArrayBuffer) -> Void, options: TTSGenerateOptions?) throws -> Promise<Void>
  func stop() throws -> Void
  func unload() throws -> Void
}

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

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

/**
 * A Swift base-protocol representing the TTS HybridObject.
 * Implement this protocol to create Swift-based instances of TTS.
 * ```swift
 * class HybridTTS : HybridTTSSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridTTSSpec = HybridTTSSpec_protocol & HybridTTSSpec_base
