public function generateBaReports(string $clientSurvey, GetBaReports $request, DetermineBaGeneratorTemplateFactory $determineBaGeneratorTemplateFactory, ChromePdfService $chromePdfService): Response|string 	{ 		$locale = $request->language ?? DomainLanguages::getDefaultLanguage(); 		$extras[] = $request->public_survey; 		$isTargetGroup = $request->boolean('is_target_group');  		try { 			$baGeneratorTemplate = $determineBaGeneratorTemplateFactory->make($request->survey_type);  			$getBaDataService = $baGeneratorTemplate->createService(); 			$survey = $baGeneratorTemplate->createClientSurvey($clientSurvey);  			$result = $getBaDataService->generate($survey, $locale, $extras); 		} catch (Throwable $th) { 			throw new ReportGenerationException( 				(string) __('client-surveys.generating-not-possible-with-error', ['error' => $th->getMessage()], $locale), 				422 			); 		}  		$app_email = setting('app_email', ''); 		$app_url = auth()->user()->user->activeDomain->domain ?? '';  		$client_name = $survey->getClientName();  		$isPreview = !$request->boolean('download');  		$view = view('pdf.ba.general-report', compact('survey', 'result', 'locale', 'isPreview', 'client_name', 'app_email', 'app_url', 'isTargetGroup'));  		if ($isPreview) { 			return $view->render(); 		}  		$data = $chromePdfService->generatePdf($view->render(), true);  		$name = $survey->generateDownloadFileName($locale);  		return response()->make($data, 200, [ 			'Content-Type' => 'application/pdf', 			'Content-Disposition' => "attachment; filename=$name", 		]); 	}