<?php

namespace Container\MenuTop;

use Helpers\Additional\Additional;
use Helpers\Additional\Specifique\Specifique;
use Helpers\Outil\Roles;
use Modules\Index\Repository\Connexion;
use Psr\Container\ContainerInterface;
use Skeleton\Router;

abstract class AbsMenuTop
{

    protected Additional $additional;

    /**
     * __construct
     *
     * @param  Additional $additional
     * @return void
     */
    public function __construct(Additional $additional)
    {
        $this->additional = $additional;
    }
    
    public function generate(string &$html, Router $router, ?string $menuActive, ContainerInterface $contenaire, \PDO $pdo): void
    {
        $listeMenu = $this->getListeAction($router, $contenaire, $pdo);
        foreach ($listeMenu as $menu) {
            $html .= "  <li id='".$menu['id']."' class='".(($menuActive == $menu['menuActive']) ?  'active' : '' )."'>
                            <a href='".$menu['path']."'>".$menu['libelle']."</a>
                        </li>";
        }
    }
    /**
     * @return array<mixed>
     */
    abstract public function getListeAction(router $router, ContainerInterface $contenaire, \PDO $pdo);
}
