""" Pydantic schemas for Category model. """ from typing import Optional from pydantic import BaseModel, Field class CategoryBase(BaseModel): """Base category schema.""" name: str = Field(..., min_length=1, max_length=100) slug: str = Field(..., min_length=1, max_length=100) class CategoryCreate(CategoryBase): """Schema for creating a new category.""" pass class CategoryUpdate(BaseModel): """Schema for updating a category.""" name: Optional[str] = Field(None, min_length=1, max_length=100) slug: Optional[str] = Field(None, min_length=1, max_length=100) class CategoryResponse(CategoryBase): """Schema for category response.""" id: int class Config: from_attributes = True