"""items 域 API 模型（对外契约，与 DB 实现无关）。"""

from datetime import datetime

from pydantic import BaseModel, Field


class ItemCreate(BaseModel):
    name: str = Field(min_length=1, max_length=128)
    description: str | None = Field(default=None, max_length=1024)


class ItemUpdate(BaseModel):
    name: str | None = Field(default=None, min_length=1, max_length=128)
    description: str | None = Field(default=None, max_length=1024)


class ItemOut(BaseModel):
    id: str
    name: str
    description: str | None
    created_at: datetime


class ItemList(BaseModel):
    total: int
    items: list[ItemOut]
