<?php

declare(strict_types=1);

namespace PhpList\WebFrontend\Controller;

use PhpList\Core\Domain\Messaging\Model\BounceAction;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

#[Route('/bounces', name: 'bounce_')]
class BouncesController extends AbstractController
{
    #[Route('/', name: 'list', methods: ['GET'])]
    public function index(Request $request): Response
    {
        $bounceActions = [];
        foreach (BounceAction::cases() as $case) {
            $bounceActions[$case->name] = $case->value;
        }

        return $this->render('@PhpListFrontend/spa.html.twig', [
            'page' => 'Bounces',
            'bounce_actions' => $bounceActions,
        ]);
    }
}
