"""Provider interfaces and shared types for transcription adapters."""

from dataclasses import dataclass
from typing import Protocol


class ProviderError(RuntimeError):
    """Base error for provider failures."""


class ProviderAuthError(ProviderError):
    """Raised when provider authentication fails."""


class ProviderResponseError(ProviderError):
    """Raised when provider responses are malformed or unusable."""


@dataclass(frozen=True)
class TranscriptionResult:
    """Normalized output returned by any transcription provider."""

    text: str
    provider: str
    model: str


class TranscriptionProvider(Protocol):
    """Contract every transcription provider adapter must satisfy."""

    def transcribe(self, *, prompt_text: str, image_bytes: bytes, mime_type: str) -> TranscriptionResult:
        """Transcribe the provided image according to the prompt text."""
        ...
