<?php

declare(strict_types=1);

namespace App\Handler;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Zend\Diactoros\Response\RedirectResponse;
use Zend\Expressive\Helper\UrlHelper;

class PrizeRedirectHandler implements RequestHandlerInterface
{
    /** @var UrlHelper  */
    private $urlHelper;

    public function __construct(UrlHelper $urlHelper)
    {
        $this->urlHelper = $urlHelper;
    }

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $url = $this->urlHelper->generate('the-prize.article', [
            'article' => 'background-and-purpose',
        ]);
        return new RedirectResponse($url);
    }
}
