from typing import Optional, List
from pydantic import BaseModel, ConfigDict

class ProjectCreate(BaseModel):
    project_name: str
    client_name: str

    model_config = ConfigDict(extra="forbid")

class ProjectRead(BaseModel):
    id: int
    project_name: str
    client_name: str
    overlay_image_path: Optional[str]
    logo_image_path: Optional[str] = None

    model_config = ConfigDict(from_attributes=True, extra="ignore")

class ProjectUpdateResponse(BaseModel):
    success: bool
    message: str
    project_id: int

class ProjectListResponse(BaseModel):
    success: bool = True
    page: int
    limit: int
    total: int
    projects: List[ProjectRead]

    model_config = ConfigDict(from_attributes=True, extra="ignore")

class ProductTemplateInfo(BaseModel):
    name: str
    preview_png_path: str
    ratio: str

    model_config = ConfigDict(from_attributes=True)

class ProductImageDetailRead(BaseModel):
    id: int
    final_image_path: str
    product_template: ProductTemplateInfo

    model_config = ConfigDict(from_attributes=True)

class ProjectDetailRead(ProjectRead):
    images: List[ProductImageDetailRead]
