<?php

namespace Src\Modules\Auth\Pages\Admin;

use Src\Modules\Auth\Interfaces\Pages\Admin\IFactory;
use Src\Modules\Auth\Interfaces\Pages\IFactory as IPagesFactory;

class Factory implements IFactory
{
    protected IPagesFactory $pagesFactory;

    public function setPagesFactory(IPagesFactory $factory): void
    {
        $this->pagesFactory = $factory;
    }

    public function createAdminFormPage(?string $adminId): AdminForm
    {
        $page = new AdminForm();
        $sidebar = $this->pagesFactory->getModuleFactory()->getModulesProvider()->getSidebarFactory()->getMenu();
        $page->setSidebar($sidebar);
        $page->init($adminId);
        return $page;
    }

    public function createAdminsListPage(): AdminsList
    {
        $page = new AdminsList();
        $sidebar = $this->pagesFactory->getModuleFactory()->getModulesProvider()->getSidebarFactory()->getMenu();
        $page->setSidebar($sidebar);
        return $page;
    }

    public function creteLoginFormPage(): LoginForm
    {
        $page = new LoginForm();

        return $page;
    }
}