<?php

declare(strict_types=1);

namespace App\Application\Admin;

use App\Application\Admin\Service\AdminLayoutProcessor;
use App\Framework\Attributes\Route;
use App\Framework\Auth\Auth;
use App\Framework\Meta\MetaData;
use App\Framework\Router\Result\ViewResult;

final readonly class ShowUploadTest
{
    public function __construct(
        private AdminLayoutProcessor $layoutProcessor,
    ) {
    }

    #[Auth]
    #[Route('/admin/test/upload')]
    public function __invoke(): ViewResult
    {
        $data = [
            'title' => 'JavaScript Upload Test',
            'description' => 'Test page for JavaScript file upload functionality with CSRF protection.',
        ];

        $finalData = $this->layoutProcessor->processLayoutFromArray($data);

        $metaData = MetaData::create(
            title: 'JavaScript Upload Test | Admin Panel',
            description: 'Test JavaScript upload functionality'
        );

        return new ViewResult('upload-test', $metaData, $finalData);
    }
}
