graph TD
A[Input Data Points] --> B[Initialize ResultAssembler]
B --> C[Validate Input Arrays]
C --> D{All Inputs Valid?}
D -->|No| E[Error Handler]
E --> F[Return Error JSON]
D -->|Yes| G[Create JSON Structure]
G --> H[Map Prompts to Images]
H --> I[Map Images to Videos]
I --> J[Format Results Array]
J --> K[Validate JSON Structure]
K --> L{JSON Valid?}
L -->|No| M[Fix JSON Format]
M --> K
L -->|Yes| N[Return Final JSON]
subgraph Input Processing
A --> O[Process Prompts]
A --> P[Process Image URLs]
A --> Q[Process Video URLs]
end
subgraph Validation Checks
O --> C
P --> C
Q --> C
end