"""Infra layer: expose a simple module-level API backed by
`TranscribeService` adapter.

This replaces the previous re-export from `transcribe_impl` so the
implementation lives inside the adapter class.
"""

from .transcribe_adapter import TranscribeService


# default service instance used by module-level helpers
_DEFAULT = TranscribeService()


def transcribe_openai_whisper(file: str):
    return _DEFAULT.transcribe_openai(file)


def transcribe_transformers(file: str):
    return _DEFAULT.transcribe_transformers(file)


def transcribe_faster_whisper(file: str):
    return _DEFAULT.transcribe_faster(file)


def write_srt(segments, out_path: str):
    return _DEFAULT.write_srt(segments, out_path)


def dedupe_adjacent_segments(segments):
    return _DEFAULT.dedupe_adjacent_segments(segments)


def get_audio_duration(file_path: str):
    return _DEFAULT.get_audio_duration(file_path)


def make_uniform_segments(duration: float, seg_seconds: float):
    return _DEFAULT.make_uniform_segments(duration, seg_seconds)


def transcribe_segmented_with_tempfiles(*args, **kwargs):
    return _DEFAULT.transcribe_segmented_with_tempfiles(*args, **kwargs)


def tts_synthesize(text: str, out_path: str, model: str = "kokoro") -> bool:
    return _DEFAULT.tts_synthesize(text, out_path, model=model)


def ensure_tts_model(repo_id: str):
    return _DEFAULT.ensure_tts_model(repo_id)


__all__ = [
    "transcribe_openai_whisper",
    "transcribe_transformers",
    "transcribe_faster_whisper",
    "write_srt",
    "dedupe_adjacent_segments",
    "get_audio_duration",
    "make_uniform_segments",
    "transcribe_segmented_with_tempfiles",
    "tts_synthesize",
    "ensure_tts_model",
]
