<?php

namespace App\Services\Scores;

use App\Interfaces\ScoreCalculatorInterface;
use App\Models\Homework;

class HomeworkCalculator implements ScoreCalculatorInterface
{
    public function __construct(private Homework $homeworkModel)
    {
    }

    public function calculate(int $studentId, string $semester, string $schoolYear, ?int $classSectionId = null): array
    {
        $average = Homework::getAverageHomeworkScore($studentId, $semester, $schoolYear, $classSectionId);
        return ['homework_avg' => $average !== null ? (float) $average : null];
    }
}
