<?php

namespace Modules\Ajax\Repository;

use Helpers\Outil\Sql;
use Helpers\QueryBuilder\AbsRepository;

class Favoris extends AbsRepository
{
    /**
     * @return string[][]
     */
    public function listeFavoris()
    {
        $req = 'SELECT * FROM FAVORIS with (nolock) WHERE ID_USER = :idUser';
        
        return $this->fetchAssocAll($req, [
            ':idUser' => $_SESSION['Session_Login']
        ]);
    }
    
    /**
     * @return array<mixed>
     */
    public function listeFavorisAccesRapide()
    {
        $req = 'SELECT * FROM FAVORIS with (nolock) WHERE ID_USER=:idUser AND ACCES_RAPIDE = '.SQL::setBoolSql(1).' ORDER BY POSITION_FAV, ID_FAV';
        
        return $this->fetchAssocAll($req, [
            ':idUser' => $_SESSION['Session_Login']
        ]);
    }
}
