from datetime import datetime from pydantic import BaseModel, ConfigDict, Field class MindmapNode(BaseModel): id: str label: str parent_id: str | None = None level: int is_leaf: bool children: list["MindmapNode"] = Field(default_factory=list) MindmapNode.model_rebuild() class MindmapCreateRequest(BaseModel): session_id: str = Field(min_length=1, max_length=255) mindmap_json: dict class MindmapResponse(BaseModel): model_config = ConfigDict(from_attributes=True) id: int unique_id: str session_id: str title: str raw_json: str tree: MindmapNode url: str created_at: datetime updated_at: datetime