<?php

declare(strict_types=1);

namespace KupShop\AdminBundle\Admin;

use KupShop\AdminBundle\Util\ShopStoreUtils;
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;

class ShopStoreModule extends \Window
{
    public function fetchObject($table, $ID)
    {
        /** @var ShopStoreUtils $utils */
        $utils = ServiceContainer::getService(ShopStoreUtils::class);

        $modules = $utils->getModules((bool) getVal('skip_cache'));

        $module = $modules['modules'][$this->getID()];

        $module['categories'] = array_map(fn ($id) => $modules['categories'][$id], $module['categories']);

        return $module;
    }

    public function hasRights($name = null)
    {
        return false;
    }
}

return ShopStoreModule::class;
