param(
    [string]$Title = "Antigravity",
    [string]$Message = "タスクが完了しました"
)

try {
    Add-Type -AssemblyName System.Speech
    $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
    
    # Format speech text
    if ($Title -eq $Message) {
        $text = $Message
    } elseif ([string]::IsNullOrEmpty($Title)) {
        $text = $Message
    } elseif ([string]::IsNullOrEmpty($Message)) {
        $text = $Title
    } else {
        $text = "${Title}。${Message}"
    }
    
    $synth.Speak($text)
} catch {
    Write-Error "音声読み上げに失敗しました: $_"
}
