simulation_plan.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. """Simulation plan schemas."""
  2. from datetime import datetime
  3. from typing import Optional, Any
  4. from pydantic import BaseModel, Field
  5. class PlanCreate(BaseModel):
  6. project_id: int
  7. name: str = Field(..., min_length=1, max_length=200)
  8. plan_data: dict[str, Any] = Field(..., description="Full simulation_plan.json content")
  9. notes: str = ""
  10. class PlanUpdate(BaseModel):
  11. name: Optional[str] = None
  12. status: Optional[str] = None
  13. plan_data: Optional[dict[str, Any]] = None
  14. notes: Optional[str] = None
  15. class PlanResponse(BaseModel):
  16. id: int
  17. project_id: int
  18. name: str
  19. plan_id: str
  20. status: str
  21. plan_data: dict[str, Any]
  22. variables_summary: dict[str, Any] = Field(default_factory=dict)
  23. estimated_points: int = 0
  24. estimated_time_min: int = 0
  25. notes: str
  26. result_count: int = 0
  27. created_at: datetime
  28. updated_at: datetime
  29. class Config:
  30. from_attributes = True
  31. class PlanListResponse(BaseModel):
  32. total: int
  33. items: list[PlanResponse]
  34. class PlanDownloadResponse(BaseModel):
  35. """Response for plan download - returns raw JSON compatible with local executor."""
  36. plan_id: str
  37. plan_data: dict[str, Any]