<?php  namespace App\Models;  use App\Enums\QuestionType; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Relations\BelongsTo;  /**  * @property array|float|int|string $answer_value  */ class Answer extends Model { 	public const EMPLOYEE_ENGAGEMENT = 3.45;  	public static function getAnswersForGeneralReportPdf(array|string $questions, array $applicants): Collection 	{ 		return Answer::select(DB::raw('count(answer_value) as answer_value_count, answer_value as value')) 							->groupBy('answer_value') 							->when(is_string($questions), function ($query) use ($questions) { 								$query->where('question_id', $questions); 							}, function ($query) use ($questions) { 								$query->whereIn('question_id', $questions); 							}) 							->whereIn('applicant_id', $applicants) 							->get(); 	}  	public static function getEmployeeEngagementAnswers(array $questions, array $applicants): Collection 	{ 		return Answer::select(DB::raw('applicant_id, avg(answer_value) as answer_value_average')) 					->groupBy('applicant_id') 					->whereIn('question_id', $questions) 					->whereIn('applicant_id', $applicants) 					->having('answer_value_average', '>=', self::EMPLOYEE_ENGAGEMENT) 					->get(); 	}  	public static function pullApplicantsIds(array $applicants, string $question, int $gender): array 	{ 		return Answer::whereIn('applicant_id', $applicants)->where('question_id', $question)->where('answer_value', $gender)->pluck('applicant_id')->all(); 	}  	public function question(): BelongsTo{}  	public function applicant(): BelongsTo{}  	public function survey(): BelongsTo{}  	public function scopeBasicQuestionAnswer(Builder $query): Builder{}  	protected function answerValue(): Attribute{} }