"""Pydantic schemas for CoordSessionLock.""" from datetime import datetime from typing import Optional from uuid import UUID from pydantic import BaseModel, Field class CoordSessionLockCreate(BaseModel): """Input schema for claiming a lock.""" project_key: str = Field(..., description="Project namespace", max_length=200) session_id: str = Field(..., description="Session claiming the lock", max_length=200) resource: str = Field(..., description="Resource path being locked, e.g. 'server/src/'", max_length=500) description: Optional[str] = Field(None, description="Why this lock is needed") ttl_hours: float = Field(2.0, description="Lock lifetime in hours; 0 = no expiry", ge=0) class CoordSessionLockUpdate(BaseModel): """Input schema for updating a lock (rarely needed directly).""" description: Optional[str] = None expires_at: Optional[datetime] = None class CoordSessionLockResponse(BaseModel): """Output schema for a lock.""" id: UUID project_key: str session_id: str resource: str description: Optional[str] acquired_at: datetime expires_at: Optional[datetime] released_at: Optional[datetime] created_at: datetime updated_at: datetime model_config = {"from_attributes": True}