<?php

namespace CpCreation\VitiCore\Bridge\Symfony\Bundle\Controller\Site;

use CpCreation\VitiCore\Season\Repository\SeasonRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;

final class SeasonController extends AbstractController
{
    public function __construct(
        private readonly SeasonRepository $seasonRepository,
    ) {
    }

    /**
     * @throws \Exception
     */
    public function index(): Response
    {
        $seasons = $this->seasonRepository->findBy([], ['position' => 'ASC']);

        return $this->render('season.html.twig', [
            'classMenu' => 'black',
            'seasons' => $seasons,
        ]);
    }
}
