<?php

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

use CpCreation\VitiCore\Contact\Repository\ContactRepository;
use Doctrine\ORM\NonUniqueResultException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;

final class LegalController extends AbstractController
{
    public function __construct(
        private readonly ContactRepository $contactRepository,
    ) {
    }

    /**
     * @throws NonUniqueResultException
     */
    public function index(): Response
    {
        $contact = $this->contactRepository->findOne();

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