*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'status' => $this->status->value, 'is_manual' => (bool) $this->is_manual, 'node_run_count' => (int) ($this->node_runs_count ?? 0), 'duration_ms' => $this->durationInMilliseconds(), 'error_message' => is_array($this->error) ? ($this->error['message'] ?? null) : $this->error, 'created_at' => $this->created_at, 'started_at' => $this->started_at, 'finished_at' => $this->finished_at, ]; } }