from __future__ import annotations from typing import Any from pydantic import BaseModel, Field class ScreenerCatalogResponse(BaseModel): factor_groups: dict[str, list[str]] factors: dict[str, str] stage: list[dict[str, Any]] curated: list[dict[str, Any]] class ScreenerWorkspaceResponse(BaseModel): trade_date: str | None message: str catalog: ScreenerCatalogResponse stage_runs: list[dict[str, Any]] curated_runs: list[dict[str, Any]] custom_strategies: list[dict[str, Any]] custom_runs: list[dict[str, Any]] = Field(default_factory=list) class ScreenerSyncResponse(BaseModel): trade_date: str factor_version: str factor_count: int phase: str stage_runs: int curated_runs: int completed: int failed: int class CustomStrategyInput(BaseModel): name: str = Field(min_length=1, max_length=30) formula: dict[str, Any] class FormulaCompileInput(BaseModel): description: str = Field(min_length=5, max_length=500) class FormulaCompileResponse(BaseModel): formula: dict[str, Any] prompt_version: str class TrackInput(BaseModel): run_id: int = Field(gt=0) identifier: str = Field(min_length=1, max_length=40) class IdentifierResponse(BaseModel): id: int class MessageResponse(BaseModel): message: str