import api from './client' export interface WorkflowDefinition { id: string name: string output_type_id: string | null config: WorkflowConfig is_active: boolean created_at: string } export interface WorkflowConfig { type: 'still' | 'turntable' | 'multi_angle' | 'custom' params: WorkflowParams nodes?: WorkflowNode[] } export interface WorkflowParams { render_engine?: 'cycles' | 'eevee' samples?: number resolution?: [number, number] fps?: number duration_s?: number angles?: number[] } export interface WorkflowNode { id: string type: string position: { x: number; y: number } data: Record } export interface WorkflowCreate { name: string output_type_id?: string | null config: WorkflowConfig is_active?: boolean } export interface WorkflowRun { id: string workflow_def_id: string | null order_line_id: string | null celery_task_id: string | null status: 'pending' | 'running' | 'completed' | 'failed' started_at: string | null completed_at: string | null error_message: string | null created_at: string node_results: WorkflowNodeResult[] } export interface WorkflowNodeResult { id: string node_name: string status: string output: Record | null log: string | null duration_s: number | null created_at: string } export const getWorkflows = (): Promise => api.get('/workflows').then(r => r.data) export const getWorkflow = (id: string): Promise => api.get(`/workflows/${id}`).then(r => r.data) export const createWorkflow = (data: WorkflowCreate): Promise => api.post('/workflows', data).then(r => r.data) export const updateWorkflow = (id: string, data: Partial): Promise => api.put(`/workflows/${id}`, data).then(r => r.data) export const deleteWorkflow = (id: string): Promise => api.delete(`/workflows/${id}`).then(() => undefined) export const getWorkflowRuns = (workflowId: string): Promise => api.get(`/workflows/${workflowId}/runs`).then(r => r.data)