<?php

declare(strict_types=1);

namespace App\Application\Website;

use App\Framework\Attributes\Route;
use App\Framework\Attributes\StaticPage;
use App\Framework\Meta\StaticPageMetaResolver;
use App\Framework\Router\Result\ViewResult;
use App\Framework\Router\WebRoutes;
use RecursiveDirectoryIterator;

final readonly class ShowImpressum
{
    #[StaticPage]
    #[Route(path: '/impressum', name: WebRoutes::IMPRESSUM)]
    public function impressum(): ViewResult
    {
        // Media cleanup logic moved to App\Application\Media\MediaCleanupService
        // This eliminates the 600ms+ performance issue caused by:
        // - RecursiveDirectoryIterator over all files
        // - Database queries for every file
        // - File system operations during web request

        return new ViewResult(
            'impressum',
            new StaticPageMetaResolver(
                'Impressum',
                'Hallo Welt!',
            )(),
            ['text' => 'Hallo Welt!'],
        );
    }

    #[Route(path: '/datenschutz', name: WebRoutes::DATENSCHUTZ)]
    public function datenschutz(): ViewResult
    {
        return new ViewResult(
            'impressum',
            new StaticPageMetaResolver(
                'Datenschutz',
                'Hallo Welt!',
            )(),
            ['title' => 'Datenschutz!'],
        );
    }
}
