"""Project schemas."""
from datetime import datetime
from typing import Optional, Any
from pydantic import BaseModel, Field


class ProjectCreate(BaseModel):
    name: str = Field(..., min_length=1, max_length=200)
    description: str = ""
    topology: str = "SSSR"
    model_path: str = ""
    boundary_conditions: dict[str, Any] = Field(default_factory=dict)


class ProjectUpdate(BaseModel):
    name: Optional[str] = None
    description: Optional[str] = None
    topology: Optional[str] = None
    model_path: Optional[str] = None
    status: Optional[str] = None
    boundary_conditions: Optional[dict[str, Any]] = None


class ProjectResponse(BaseModel):
    id: int
    name: str
    description: str
    topology: str
    model_path: str
    status: str
    boundary_conditions: dict[str, Any]
    plan_count: int = 0
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True


class ProjectListResponse(BaseModel):
    total: int
    items: list[ProjectResponse]
