""" Pydantic schemas for ProjectState model. Request and response schemas for tracking current state of projects. """ from datetime import datetime from typing import Optional from uuid import UUID from pydantic import BaseModel, Field class ProjectStateBase(BaseModel): """Base schema with shared ProjectState fields.""" project_id: UUID = Field(..., description="Project ID (required, unique - one state per project)") last_session_id: Optional[UUID] = Field(None, description="Last session ID that updated this state") current_phase: Optional[str] = Field(None, description="Current phase or stage of the project") progress_percentage: int = Field(0, ge=0, le=100, description="Integer percentage of completion (0-100)") blockers: Optional[str] = Field(None, description="JSON array of current blockers preventing progress") next_actions: Optional[str] = Field(None, description="JSON array of next steps to take") context_summary: Optional[str] = Field(None, description="Dense overview text of where the project currently stands") key_files: Optional[str] = Field(None, description="JSON array of important file paths for this project") important_decisions: Optional[str] = Field(None, description="JSON array of key decisions made for this project") class ProjectStateCreate(ProjectStateBase): """Schema for creating a new ProjectState.""" pass class ProjectStateUpdate(BaseModel): """Schema for updating an existing ProjectState. All fields are optional except project_id.""" last_session_id: Optional[UUID] = Field(None, description="Last session ID that updated this state") current_phase: Optional[str] = Field(None, description="Current phase or stage of the project") progress_percentage: Optional[int] = Field(None, ge=0, le=100, description="Integer percentage of completion (0-100)") blockers: Optional[str] = Field(None, description="JSON array of current blockers preventing progress") next_actions: Optional[str] = Field(None, description="JSON array of next steps to take") context_summary: Optional[str] = Field(None, description="Dense overview text of where the project currently stands") key_files: Optional[str] = Field(None, description="JSON array of important file paths for this project") important_decisions: Optional[str] = Field(None, description="JSON array of key decisions made for this project") class ProjectStateResponse(ProjectStateBase): """Schema for ProjectState responses with ID and timestamps.""" id: UUID = Field(..., description="Unique identifier for the project state") created_at: datetime = Field(..., description="Timestamp when the state was created") updated_at: datetime = Field(..., description="Timestamp when the state was last updated") model_config = {"from_attributes": True}