# File: `Projects/veritell-langchain/src/veritell_langchain/models.py`

from __future__ import annotations

from dataclasses import dataclass, field
from typing import Any, Dict, Optional


SCHEMA_VERSION = 1


@dataclass
class VeritellEvaluationResult:
    """Simple, stable result object (MVP)."""

    score: Optional[float] = None
    passed: Optional[bool] = None
    feedback: str = ""
    metadata: Dict[str, Any] = field(default_factory=dict)
    raw_response: Dict[str, Any] = field(default_factory=dict)

    def __repr__(self) -> str:  # pragma: no cover
        fb = self.feedback or ""
        if len(fb) > 60:
            fb = fb[:57] + "..."
        return (
            "VeritellEvaluationResult("
            f"score={self.score!r}, passed={self.passed!r}, feedback={fb!r})"
        )


@dataclass
class VeritellStreamEvent:
    """Represents a single event from the streaming NDJSON API response."""

    event_type: str
    data: Optional[Dict[str, Any]] = None
    raw: Optional[Dict[str, Any]] = None

    def __repr__(self) -> str:  # pragma: no cover
        return f"VeritellStreamEvent(event_type={self.event_type!r}, data_keys={list((self.data or {}).keys())[:10]!r})"


__all__ = [
    "SCHEMA_VERSION",
    "VeritellEvaluationResult",
    "VeritellStreamEvent",
]
