<?php declare(strict_types=1);

namespace App\Engine\Admin\Storage;

use JetBrains\PhpStorm\NoReturn;

final class FileManagerController extends \App\Engine\Admin\Inertia\BaseInertiaAdminController
{

    public function getId(): string
    {
        return "FileManager";
    }

    public function index(
        \App\Engine\PageMeta\PageMeta                      $pageMeta,
        \Symfony\Contracts\Translation\TranslatorInterface $translator,
    ): \Symfony\Component\HttpFoundation\Response {
        $pageMeta->getInstance()->title = $translator->trans("admin.menu.fileManager");

        return $this->inertia->render(
            component: "{$this->getVueComponent()}/Manager",
            props: $this->getInertiaProps(),
        );
    }

    public function standAlone(): \Symfony\Component\HttpFoundation\Response
    {
        return $this->inertia->render(
            component: "{$this->getVueComponent()}/StandAlone",
            props: $this->getInertiaProps($this->createPropsForStandAlone()),
        );
    }

    public function standAlonePicker(): \Symfony\Component\HttpFoundation\Response
    {
        return $this->inertia->render(
            component: "{$this->getVueComponent()}/StandAlonePicker",
            props: $this->getInertiaProps($this->createPropsForStandAlone()),
        );
    }

    #[NoReturn]
    public function flmngrApi(): \Symfony\Component\HttpFoundation\Response
    {
        throw new \LogicException('No longer supported!');
    }

    private function createPropsForStandAlone(): \App\Engine\Inertia\Admin\Props\AdministrationProps
    {
        $props = new \App\Engine\Inertia\Admin\Props\AdministrationProps();
        $props->location = 'fileManager';
        return $props;
    }

}