import Foundation
import Speech

// Check what's available in Speech framework
print("=== Speech Framework API Availability ===")

// SFSpeechRecognizer
print("SFSpeechRecognizer available: true")

// Check for SFSpeechRecognitionMetadata (iOS 17+, macOS 14+)
let mdClass = NSClassFromString("SFSpeechRecognitionMetadata")
print("SFSpeechRecognitionMetadata: \(mdClass != nil ? "✅ Available" : "❌ Not available")")

// Check SFSpeechAnalyzer (iOS 17+, macOS 14+)
let analyzerClass = NSClassFromString("SFSpeechAnalyzer")
print("SFSpeechAnalyzer: \(analyzerClass != nil ? "✅ Available" : "❌ Not available")")

// Check for speaker identification types
let seClass = NSClassFromString("SFSpeakerEmbedding")
print("SFSpeakerEmbedding: \(seClass != nil ? "✅ Available" : "❌ Not available")")

let siClass = NSClassFromString("SFSpeakerIdentification")
print("SFSpeakerIdentification: \(siClass != nil ? "✅ Available" : "❌ Not available")")

let sevClass = NSClassFromString("SFSpeakerEmbeddingVector")
print("SFSpeakerEmbeddingVector: \(sevClass != nil ? "✅ Available" : "❌ Not available")")

let srClass = NSClassFromString("SFSpeakerRecognition")
print("SFSpeakerRecognition: \(srClass != nil ? "✅ Available" : "❌ Not available")")

// Check for AFVoiceBank / AVAudioSession speaker recognition
let avClass = NSClassFromString("AVVoiceBank")
print("AVVoiceBank: \(avClass != nil ? "✅ Available" : "❌ Not available")")

// Check AVAudioSession
if #available(macOS 14, *) {
    print("macOS 14+ APIs available: ✅")
} else {
    print("macOS 14+ APIs: ❌")
}

// Summarize
print()
print("=== Summary ===")
print("SFSpeechAnalyzer: \(analyzerClass != nil ? "✅ High-level speech analysis API" : "❌ Not available on this macOS version")")
print("Speaker recognition APIs: \(seClass != nil || siClass != nil || srClass != nil ? "✅ Speaker recognition APIs exist" : "❌ No speaker recognition APIs found")")
