<?php

declare(strict_types=1);

use BotGuard\Controllers\Install\InstallController;
use BotGuard\Core\Router;

/**
 * Installation wizard routes.
 *
 * Access is governed globally by SetupMiddleware (only reachable before the app
 * is installed). POST steps are CSRF-protected.
 */
return static function (Router $router): void {
    $router->group(['prefix' => '/install'], static function (Router $r): void {
        $r->get('', InstallController::class . '@index');
        $r->get('/welcome', InstallController::class . '@welcome');

        $r->get('/license', InstallController::class . '@license');
        $r->post('/license', InstallController::class . '@saveLicense', ['csrf']);

        $r->get('/requirements', InstallController::class . '@requirements');

        $r->get('/database', InstallController::class . '@database');
        $r->post('/database', InstallController::class . '@saveDatabase', ['csrf']);

        $r->get('/administrator', InstallController::class . '@administrator');
        $r->post('/administrator', InstallController::class . '@saveAdministrator', ['csrf']);

        $r->get('/website', InstallController::class . '@website');
        $r->post('/website', InstallController::class . '@saveWebsite', ['csrf']);

        $r->get('/install', InstallController::class . '@install');
        $r->post('/install', InstallController::class . '@run', ['csrf']);

        $r->get('/finish', InstallController::class . '@finish');
    });
};
