<?php

declare(strict_types=1);

namespace App\Game\Controller;

use App\Tech\Repository\EmailLogRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;

#[Route('/admin/email-log')]
#[IsGranted('ROLE_ADMIN')]
final class GameAdminEmailLogController extends AbstractController
{
    #[Route('', name: 'game_admin_email_log', methods: ['GET'])]
    public function index(EmailLogRepository $emailLogRepository): Response
    {
        return $this->render('game/admin/email_log/index.html.twig', [
            'logs' => $emailLogRepository->findBy([], ['sentAt' => 'DESC']),
        ]);
    }
}
