/**
 * Mock transcription provider for testing.
 *
 * Returns deterministic transcription results without calling any external API.
 * Always reports as configured.
 */

import type { TranscriptionProvider, TranscriptionInput, TranscriptionResult } from '../types.js';

export class MockTranscriptionProvider implements TranscriptionProvider {
  isConfigured(): boolean {
    return true;
  }

  async transcribe(input: TranscriptionInput): Promise<TranscriptionResult> {
    // Simulate ~50ms processing time
    await new Promise(resolve => setTimeout(resolve, 50));

    const audioSizeKB = Math.round(input.audio.byteLength / 1024);

    return {
      text: `[Mock transcription of ${input.filename} (${audioSizeKB}KB)]`,
      language: input.language ?? 'en',
      durationSeconds: Math.max(1, Math.round(input.audio.byteLength / 16000)),
      model: 'mock-stt',
    };
  }
}
