<?php

declare(strict_types=1);

use Psr\Container\ContainerInterface;
use Zend\Expressive\Application;
use Zend\Expressive\MiddlewareFactory;

/**
 * Setup routes with a single request method:
 *
 * $app->get('/', App\Handler\HomePageHandler::class, 'home');
 * $app->post('/album', App\Handler\AlbumCreateHandler::class, 'album.create');
 * $app->put('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.put');
 * $app->patch('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.patch');
 * $app->delete('/album/:id', App\Handler\AlbumDeleteHandler::class, 'album.delete');
 *
 * Or with multiple request methods:
 *
 * $app->route('/contact', App\Handler\ContactHandler::class, ['GET', 'POST', ...], 'contact');
 *
 * Or handling all request methods:
 *
 * $app->route('/contact', App\Handler\ContactHandler::class)->setName('contact');
 *
 * or:
 *
 * $app->route(
 *     '/contact',
 *     App\Handler\ContactHandler::class,
 *     Zend\Expressive\Router\Route::HTTP_METHOD_ANY,
 *     'contact'
 * );
 */
return function (Application $app, MiddlewareFactory $factory, ContainerInterface $container) : void {
    $app->get('/', App\Handler\HomePageHandler::class, 'home');
    $app->get('/api/ping', App\Handler\PingHandler::class, 'api.ping');

    $app->get('/the-prize', App\Handler\PrizeRedirectHandler::class, 'the-prize');
    $app->get(
        '/the-prize/{article:background-and-purpose|description-and-values|aspects-for-selection|gran-prize-award-events}',
        App\Handler\ArticleHandler::class,
        'the-prize.article'
    );

    $app->get('/judges', App\Handler\JudgesHandler::class, 'judges');
    $app->get('/awardees', App\Handler\AwardeeRedirectHandler::class, 'awardees');
    $app->get('/awardees/{year:\d+}', App\Handler\AwardeeHandler::class, 'awardees-by-year');
    $app->get('/awardee/{slug}', App\Handler\ProfileHandler::class, 'awardee');
};
