import uuid
from datetime import datetime
from pydantic import BaseModel
from app.domains.rendering.schemas import RenderPositionOut


class ProductCreate(BaseModel):
    pim_id: str
    name: str | None = None
    category_key: str | None = None
    ebene1: str | None = None
    ebene2: str | None = None
    baureihe: str | None = None
    produkt_baureihe: str | None = None
    lagertyp: str | None = None
    name_cad_modell: str | None = None
    gewuenschte_bildnummer: str | None = None
    medias_rendering: bool | None = None
    components: list[dict] = []
    cad_part_materials: list[dict] = []
    notes: str | None = None
    is_active: bool = True
    source_excel: str | None = None


class ProductPatch(BaseModel):
    name: str | None = None
    category_key: str | None = None
    ebene1: str | None = None
    ebene2: str | None = None
    baureihe: str | None = None
    produkt_baureihe: str | None = None
    lagertyp: str | None = None
    name_cad_modell: str | None = None
    gewuenschte_bildnummer: str | None = None
    medias_rendering: bool | None = None
    components: list[dict] | None = None
    cad_part_materials: list[dict] | None = None
    notes: str | None = None
    is_active: bool | None = None


class ProductOut(BaseModel):
    id: uuid.UUID
    pim_id: str
    name: str | None
    category_key: str | None
    ebene1: str | None
    ebene2: str | None
    baureihe: str | None
    produkt_baureihe: str | None
    lagertyp: str | None
    name_cad_modell: str | None
    gewuenschte_bildnummer: str | None
    medias_rendering: bool | None
    components: list[dict]
    cad_part_materials: list[dict]
    cad_file_id: uuid.UUID | None
    thumbnail_url: str | None = None
    render_image_url: str | None = None
    processing_status: str | None = None
    stl_cached: list[str] = []
    cad_parsed_objects: list[str] | None = None
    cad_mesh_attributes: dict | None = None
    arbeitspaket: str | None = None
    notes: str | None
    is_active: bool
    source_excel: str | None
    render_positions: list[RenderPositionOut] = []
    created_at: datetime
    updated_at: datetime

    model_config = {"from_attributes": True}
