"""Material library DTOs.""" from __future__ import annotations from dataclasses import dataclass from typing import Any @dataclass(frozen=True) class RawAnalysis: schema_version: str prompt_version: str created_at: str model_source: dict[str, Any] attributes: dict[str, Any] description: str | None = None source_payload: dict[str, Any] | None = None def to_dict(self) -> dict[str, Any]: return { "schema_version": self.schema_version, "prompt_version": self.prompt_version, "created_at": self.created_at, "model_source": self.model_source, "attributes": self.attributes, "description": self.description, "source_payload": self.source_payload or {}, } @dataclass(frozen=True) class NormalizedAssetProfile: schema_version: str prompt_version: str created_at: str category: str role: str body_slots: list[str] wear_layer: str | None attributes: dict[str, Any] must_preserve: list[str] forbidden_changes: list[str] confidence: float requires_confirmation: bool confirmed: bool = False user_locked: bool = False stackable: bool = False def to_dict(self) -> dict[str, Any]: return dict(self.__dict__) @dataclass(frozen=True) class GenerationCapsule: schema_version: str prompt_version: str created_at: str tier: str prompt_parts: list[str] negative_parts: list[str] must_preserve: list[str] forbidden_changes: list[str] legacy: bool = False def to_dict(self) -> dict[str, Any]: return dict(self.__dict__) @dataclass(frozen=True) class MaterialCategory: category_id: str name: str parent_id: str | None category_type: str sort_order: int metadata: dict[str, Any] created_at: str updated_at: str def to_dict(self) -> dict[str, Any]: return { "category_id": self.category_id, "name": self.name, "parent_id": self.parent_id, "category_type": self.category_type, "sort_order": self.sort_order, "metadata": self.metadata, "created_at": self.created_at, "updated_at": self.updated_at, } @dataclass(frozen=True) class Material: material_id: str category_id: str | None display_name: str image_uri: str | None thumbnail_uri: str | None prompt: str | None negative_prompt: str | None tags: list[str] recognition_status: str metadata: dict[str, Any] created_at: str updated_at: str def to_dict(self) -> dict[str, Any]: return { "material_id": self.material_id, "category_id": self.category_id, "display_name": self.display_name, "image_uri": self.image_uri, "thumbnail_uri": self.thumbnail_uri, "prompt": self.prompt, "negative_prompt": self.negative_prompt, "tags": self.tags, "recognition_status": self.recognition_status, "metadata": self.metadata, "created_at": self.created_at, "updated_at": self.updated_at, } @dataclass(frozen=True) class MaterialListResult: items: list[Material] total: int page: int page_size: int def to_dict(self) -> dict[str, Any]: return { "items": [item.to_dict() for item in self.items], "total": self.total, "page": self.page, "page_size": self.page_size, }