<?php

namespace Modules\Evaluation\MenuContextuel;

use Helpers\Outil\MenuContextuel;
use Helpers\Trad\ITrad;
use Helpers\Trad\Trad;
use Skeleton\Router;

class ResultatMenuContextuel extends MenuContextuel
{
    /**
     * @var array<mixed> droit
     */
    public $droit;

    public function __construct(\PDO $pdo, Router $router, ITrad $trad)
    {
        parent::__construct($pdo, $router, $trad);

        $this->droit = [];
    }

    /**
     * @param string $campaign
     * @param string $supplier
     * @return array<mixed>
     */
    public function generateSupplierMenu(string $campaign, string $supplier): array
    {
        $menuContextuel = [];

        $menuContextuel['listeSecondaire'][] = [
            'lien' => $this->router->generateUri('Evaluation.Resultat.comparativeView', ['supplier' => $supplier]),
            'libelle' => $this->trad->t('Détails fournisseur'),
        ];

        $menuContextuel['listeSecondaire'][] = [
            'lien' => '',
            'libelle' => $this->trad->t('Export résultats fournisseur'),
            'lienJs' => "exportCSV2('" . $this->router->generateUri('Evaluation.Resultat.export', ['campaign' => $campaign, 'supplier' => $supplier]) . "', 
                'filtre_campagne', 
                '" . $this->router->generateUri('Ajax.Erreur.popupInformation') . "', 
                '" . $this->router->generateUri('Ajax.Outil.appelAsync') . "');",
        ];

        return $menuContextuel;
    }

    /**
     * @param string $idCamp
     * @return array<mixed>
     */
    public function generateCampaignMenu(string $idCamp): array
    {
        $menuContextuel = [];

        $menuContextuel['listeSecondaire'][] = [
            'lien' => $this->router->generateUri('Evaluation.Resultat.index', ['id' => $idCamp]),
            'libelle' => $this->trad->t('Résultats campagne'),
        ];

        return $menuContextuel;
    }
}
