"""Pydantic models for alerts.""" from datetime import datetime from typing import Literal, Optional from pydantic import BaseModel, Field class AlertConfig(BaseModel): """Alert configuration model.""" enabled: bool = True positive_threshold: float = Field(0.1, description="Alert when FR > this value (%)") negative_threshold: float = Field(-0.1, description="Alert when FR < this value (%)") volume_spike_multiplier: float = Field(2.0, description="Alert when volume > avg * this value") class AlertItem(BaseModel): """Single alert item.""" symbol: str alert_type: Literal["high_positive_fr", "high_negative_fr", "volume_spike"] value: float threshold: float message: str timestamp: datetime class AlertCheckResponse(BaseModel): """Response model for alert check endpoint.""" success: bool = True alerts: list[AlertItem] total_alerts: int checked_at: datetime