<?php

namespace Container\MenuTop;

use Helpers\Additional\Additional;
use Helpers\Outil\Roles;
use Psr\Container\ContainerInterface;
use Skeleton\Router;

class PilotageAchat extends AbsMenuTop
{
    
    use \Traits\Menu\Droit;
    
    protected string $pack;
    protected Additional $additional;

    /**
     * __construct
     *
     * @param  Additional $additional
     * @return void
     */
    public function __construct(Additional $additional)
    {
        $this->pack = 'PilotageAchats';
        $this->additional = $additional;
    }

    /**
     * @return array<mixed>
     */
    public function getListeAction(router $router, ContainerInterface $contenaire, \PDO $pdo)
    {
        /** @var \Helpers\Trad\ITrad */
        $trad = $contenaire->get('translationService');

        $menu = [];
        
        if (($_SESSION['BiBliDonCreatMod'] ?? false) || ($_SESSION['Suivi_DOA'] ?? false) || ($_SESSION['CreatMod_DOA'] ?? '') || Roles::droitsUtilisateur($pdo, 'DOA_OPE_CM') || ($_SESSION['Tous_DOA']  ?? '') || \Helpers\Outil\Roles::droitsUtilisateur($pdo, 'DOA_OPE') || $this->getAll()) {
            $menu[] = [
                'id'            => 'menuTopProjetsAchats',
                'pathLogin'     => 'projetAchat',
                'path'          => $router->generateUri('ProjetAchat.GestionProjetAchat.tableauBord'),
                'libelle'       => $trad->t('Projets Achats'),
                'menuActive'    => 'ProjetAchat'
            ];
        }

        return $menu;
    }
}
