<?php

/*
 * This file is part of the Serenity package.
 *
 * (c) CP Creation <web@cpcreation.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

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

use CpCreation\VitiCore\History\Repository\HistoryRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;

final class HomeController extends AbstractController
{
    public function __construct(
        private readonly HistoryRepository $historyRepository,
    ) {
    }

    public function index(): Response
    {
        $histories = $this->historyRepository->findBy(
            ['disabled' => 0],
            ['position' => 'ASC']
        );

        return $this->render('home.html.twig', [
            'classMenu' => 'black',
            'histories' => $histories,
            'subMenu' => true,
        ]);
    }
}
