from __future__ import annotations

from dataclasses import dataclass
from typing import List, Optional


@dataclass(frozen=True)
class AnalyzeTextResult:
    """Result of single text analysis.

    Attributes:
        answer: Float value in range [0, 1].
        segmentation_tokens: Optional list of floats aligned to words when deep_scan=True.
    """

    answer: float
    segmentation_tokens: Optional[List[float]]


@dataclass(frozen=True)
class AnalyzeBatchItemResult:
    """Per-item result for batch analysis.

    Attributes:
        text: Original input text.
        answer: Float in [0, 1] or None when item failed.
        segmentation_tokens: Optional list of floats aligned to words when deep_scan=True.
        deep_scan: Whether deep scan was enabled for this item.
        error: Optional error message for this item.
    """

    text: str
    answer: Optional[float]
    segmentation_tokens: Optional[List[float]]
    deep_scan: bool
    error: Optional[str]


