# [DEF:backend.src.schemas.health:Module]
# @TIER: STANDARD
# @SEMANTICS: health, schemas, pydantic
# @PURPOSE: Pydantic schemas for dashboard health summary.
# @LAYER: Domain

from pydantic import BaseModel, Field
from typing import List, Optional
from datetime import datetime

# [DEF:DashboardHealthItem:Class]
# @PURPOSE: Represents the latest health status of a single dashboard.
class DashboardHealthItem(BaseModel):
    dashboard_id: str
    dashboard_title: Optional[str] = None
    environment_id: str
    status: str = Field(..., pattern="^(PASS|WARN|FAIL|UNKNOWN)$")
    last_check: datetime
    task_id: Optional[str] = None
    summary: Optional[str] = None
# [/DEF:DashboardHealthItem:Class]

# [DEF:HealthSummaryResponse:Class]
# @PURPOSE: Aggregated health summary for all dashboards.
class HealthSummaryResponse(BaseModel):
    items: List[DashboardHealthItem]
    pass_count: int
    warn_count: int
    fail_count: int
    unknown_count: int
# [/DEF:HealthSummaryResponse:Class]

# [/DEF:backend.src.schemas.health:Module]