"""
Analyze schemas (Alpha Terminal - Phase 2 Diligence).

Open-data-first: we return null + reason when data isn't available.
"""

from __future__ import annotations

from datetime import datetime
from typing import Any, Optional

from pydantic import BaseModel, Field


class AnalyzeItem(BaseModel):
    key: str
    label: str
    value: Optional[Any] = None
    status: str = Field(default="info", description="pass|warn|fail|info|na")
    source: str = Field(default="internal", description="internal|rdap|whois|dns|http|ssl|db|open_data")
    details: dict[str, Any] = Field(default_factory=dict)


class AnalyzeSection(BaseModel):
    key: str
    title: str
    items: list[AnalyzeItem] = Field(default_factory=list)


class AnalyzeResponse(BaseModel):
    domain: str
    computed_at: datetime
    cached: bool = False
    sections: list[AnalyzeSection]

