""" 设计作品相关 Pydantic Schemas """ from pydantic import BaseModel, Field from datetime import datetime from typing import Optional, List from .category import CategoryResponse, SubTypeResponse, ColorResponse class DesignImageResponse(BaseModel): """设计图片响应(单张视角图)""" id: int view_name: str image_url: Optional[str] = None model_used: Optional[str] = None prompt_used: Optional[str] = None sort_order: int = 0 class Config: from_attributes = True protected_namespaces = () class DesignCreate(BaseModel): """创建设计请求""" category_id: int = Field(..., description="品类ID") sub_type_id: Optional[int] = Field(None, description="子类型ID") color_id: Optional[int] = Field(None, description="颜色ID") prompt: str = Field(..., min_length=1, max_length=2000, description="设计需求") carving_technique: Optional[str] = Field(None, max_length=50, description="雕刻工艺") design_style: Optional[str] = Field(None, max_length=50, description="设计风格") motif: Optional[str] = Field(None, max_length=100, description="题材纹样") size_spec: Optional[str] = Field(None, max_length=100, description="尺寸规格") surface_finish: Optional[str] = Field(None, max_length=50, description="表面处理") usage_scene: Optional[str] = Field(None, max_length=50, description="用途场景") class DesignResponse(BaseModel): """设计作品响应""" id: int user_id: int category: CategoryResponse sub_type: Optional[SubTypeResponse] = None color: Optional[ColorResponse] = None prompt: str carving_technique: Optional[str] = None design_style: Optional[str] = None motif: Optional[str] = None size_spec: Optional[str] = None surface_finish: Optional[str] = None usage_scene: Optional[str] = None image_url: Optional[str] = None images: List[DesignImageResponse] = [] status: str created_at: datetime updated_at: datetime class Config: from_attributes = True class DesignListResponse(BaseModel): """设计作品列表响应""" items: List[DesignResponse] total: int page: int page_size: int