"""Health check models."""

from datetime import datetime
from typing import Any

from pydantic import BaseModel, Field

from .enums import HealthStatus


class HealthCheck(BaseModel):
    """Health check response"""

    status: HealthStatus = Field(..., description="Overall health status")
    timestamp: datetime = Field(
        default_factory=datetime.utcnow, description="Check timestamp"
    )
    version: str = Field(..., description="Service version")
    checks: dict[str, dict[str, Any]] = Field(
        default_factory=dict, description="Individual checks"
    )


class ServiceHealth(BaseModel):
    """Individual service health status"""

    name: str = Field(..., description="Service name")
    status: HealthStatus = Field(..., description="Service health status")
    response_time_ms: float | None = Field(
        None, description="Response time in milliseconds"
    )
    error: str | None = Field(None, description="Error message if unhealthy")
