<?php

namespace App\Services\Scores;

use App\Interfaces\ScoreCalculatorInterface;
use App\Models\Project;

class ProjectCalculator implements ScoreCalculatorInterface
{
    public function __construct(private Project $projectModel)
    {
    }

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