"""Verify report model."""

from dataclasses import dataclass, field
from datetime import datetime
from typing import Any

from .types import Verdict


@dataclass
class VerifyReport:
    """Result of a policy verification.

    Attributes:
        job_id: Unique job identifier.
        verdict: Safety verdict (SAFE, UNSAFE, ERROR).
        score: Numerical score (0.0 to 1.0).
        scenario: Scenario that was evaluated.
        episodes: Number of episodes run.
        video_url: URL to replay video (if recorded).
        report_url: URL to full report page.
        created_at: When verification started.
        completed_at: When verification completed.
        details: Additional verdict details.
    """

    job_id: str
    verdict: Verdict
    score: float
    scenario: str
    episodes: int = 5
    video_url: str | None = None
    report_url: str | None = None
    created_at: datetime | None = None
    completed_at: datetime | None = None
    details: dict[str, Any] = field(default_factory=dict)

    @property
    def is_safe(self) -> bool:
        """Return True if policy is safe."""
        return self.verdict == Verdict.SAFE

    @property
    def is_complete(self) -> bool:
        """Return True if verification is complete."""
        return self.verdict != Verdict.PENDING

    def __str__(self) -> str:
        return f"VerifyReport(verdict={self.verdict.value}, score={self.score:.2f})"
