<?php

namespace App\Services\Calculators;

use App\Interfaces\ScoreCalculatorInterface;
use App\Models\QuizModel;

class QuizCalculator implements ScoreCalculatorInterface
{
    private $quizModel;

    public function __construct(QuizModel $quizModel)
    {
        $this->quizModel = $quizModel;
    }

    public function calculate(int $studentId, string $semester, string $schoolYear, ?int $classSectionId = null): array
    {
        $average = $this->quizModel->getAverageQuizScore($studentId, $semester, $schoolYear, $classSectionId);
        
        return ['quiz_avg' => $average !== null ? (float) $average : null];
    }
}
