streamRepository->getForScenario($scenario); return response()->json([ 'streams' => StreamResource::collection($streams), 'stats' => $this->statsService->getSummaryStats($scenario) ]); } public function store(StoreStreamRequest $request, Scenario $scenario): JsonResponse { $stream = $this->streamRepository->create($scenario, $request->validated()); return response()->json([ 'stream' => new StreamResource($stream), 'message' => 'Stream created successfully.' ], 201); } public function update(UpdateStreamRequest $request, Stream $stream): JsonResponse { $stream = $this->streamRepository->update($stream, $request->validated()); return response()->json([ 'stream' => new StreamResource($stream), 'message' => 'Stream updated successfully.' ]); } public function destroy(Stream $stream): JsonResponse { $this->streamRepository->delete($stream); return response()->json([ 'message' => 'Stream deleted successfully.' ]); } public function toggle(Stream $stream): JsonResponse { $stream = $this->streamRepository->toggleActive($stream); return response()->json([ 'stream' => new StreamResource($stream), 'message' => $stream->is_active ? 'Stream activated.' : 'Stream deactivated.' ]); } }