"""Workflow and node DTOs.""" from __future__ import annotations from dataclasses import dataclass from typing import Any @dataclass(frozen=True) class ProfileWorkflow: workflow_id: str profile_id: str workflow_type: str display_name: str mode: str | None status: str current_node_id: str | None current_branch: str session_key: str | None metadata: dict[str, Any] created_at: str updated_at: str def to_dict(self) -> dict[str, Any]: return { "workflow_id": self.workflow_id, "profile_id": self.profile_id, "workflow_type": self.workflow_type, "display_name": self.display_name, "mode": self.mode, "status": self.status, "current_node_id": self.current_node_id, "current_branch": self.current_branch, "session_key": self.session_key, "metadata": self.metadata, "created_at": self.created_at, "updated_at": self.updated_at, } @dataclass(frozen=True) class WorkflowNode: node_id: str workflow_id: str node_key: str title: str description: str | None step_name: str | None node_type: str status: str branch_name: str prompt: str | None negative_prompt: str | None model_route: str | None selected_image_id: str | None sort_order: int metadata: dict[str, Any] created_at: str updated_at: str def to_dict(self) -> dict[str, Any]: return { "node_id": self.node_id, "workflow_id": self.workflow_id, "node_key": self.node_key, "title": self.title, "description": self.description, "step_name": self.step_name, "node_type": self.node_type, "status": self.status, "branch_name": self.branch_name, "prompt": self.prompt, "negative_prompt": self.negative_prompt, "model_route": self.model_route, "selected_image_id": self.selected_image_id, "sort_order": self.sort_order, "metadata": self.metadata, "created_at": self.created_at, "updated_at": self.updated_at, } @dataclass(frozen=True) class WorkflowDetail: workflow: ProfileWorkflow nodes: list[WorkflowNode] def to_dict(self) -> dict[str, Any]: return { "workflow": self.workflow.to_dict(), "nodes": [node.to_dict() for node in self.nodes], }