"""Data models for transcription."""

from dataclasses import dataclass


@dataclass
class Token:
    """A transcription token with timing information."""

    text: str
    start_ms: int
    end_ms: int
    confidence: float = 1.0
    speaker: str | None = None
    language: str | None = None


@dataclass
class TranscriptionResult:
    """Result of a transcription job."""

    id: str
    text: str
    tokens: list[Token]


@dataclass
class TranscriptionContext:
    """
    Context for improving transcription accuracy.

    The total context size is limited to ~8,000 tokens (~10,000 characters).
    """

    text: str | None = None
    terms: list[str] | None = None

    def to_dict(self) -> dict:
        """Convert to API-compatible dictionary."""
        result = {}
        if self.text:
            result["text"] = self.text
        if self.terms:
            result["terms"] = self.terms
        return result
