"""Operational endpoints that do not belong to a business context.""" from typing import Annotated, Literal from fastapi import APIRouter, Depends from pydantic import BaseModel from zhixing_server.bootstrap.config import Settings, get_settings operational_router = APIRouter() system_router = APIRouter() class HealthResponse(BaseModel): """Minimal response used by container health probes.""" status: Literal["ok"] class SystemStatusResponse(HealthResponse): """Non-domain runtime metadata displayed by the frontend smoke slice.""" service: str environment: str @operational_router.get("/healthz", response_model=HealthResponse, include_in_schema=False) def health() -> HealthResponse: """Report whether the HTTP process can serve requests. Returns: A stable response suitable for container health checks. """ return HealthResponse(status="ok") @system_router.get("/status", response_model=SystemStatusResponse) def system_status(settings: Annotated[Settings, Depends(get_settings)]) -> SystemStatusResponse: """Expose safe runtime metadata for end-to-end connectivity checks. Args: settings: Validated process settings injected by FastAPI. Returns: The service name, environment, and current availability state. """ return SystemStatusResponse( status="ok", service=settings.app_name, environment=settings.app_env, )