"""Request schemas for the EWA Demand Forecast API.""" from typing import Annotated, List, Optional from pydantic import BaseModel, Field class ForecastRequest(BaseModel): """Request body for a single forecast.""" history: Annotated[ List[float], Field( min_length=2, description="Historical demand time series (ordered from oldest to most recent)", examples=[[120.0, 135.0, 148.0, 160.0, 155.0, 172.0]], ), ] horizon: Annotated[ int, Field( ge=1, le=120, description="Number of future periods to forecast", examples=[12], ), ] = 12 alpha: Annotated[ Optional[float], Field( gt=0, le=1, description="Level smoothing factor α (0 < α ≤ 1). Auto-optimised if not provided.", examples=[0.3], ), ] = None beta: Annotated[ Optional[float], Field( gt=0, le=1, description=( "Trend smoothing factor β (0 < β ≤ 1). " "Enables Holt's double exponential smoothing when provided. " "Auto-optimised together with alpha when both are omitted." ), examples=[0.1], ), ] = None confidence_level: Annotated[ float, Field( gt=0, lt=1, description="Confidence level for prediction intervals", examples=[0.95], ), ] = 0.95 class BatchForecastRequest(BaseModel): """Request body for a batch of forecasts.""" items: Annotated[ List[ForecastRequest], Field( min_length=1, max_length=100, description="List of individual forecast requests (max 100)", ), ]