<?php

namespace Modules\Commande\Rules;

use Helpers\Outil\Roles;
use Modules\GlobalApplication\Repository\LicenceOxalys;
use Psr\Http\Message\ServerRequestInterface;

class NotationCommande
{
    protected ServerRequestInterface $request;
    protected \PDO $pdo;
        
    /**
     * __construct
     *
     * @param  ServerRequestInterface $request
     * @return void
     */
    public function __construct(ServerRequestInterface  $request, \PDO $pdo)
    {
        $this->request  = $request;
        $this->pdo      = $pdo;
    }
    
    /**
     * init
     *
     * @return bool
     */
    public function init() : bool
    {
        return (new LicenceOxalys($this->pdo))->isNoteFourActive();
    }

    public function activate() :bool
    {
        return Roles::droitsUtilisateur($this->pdo, 'HA_NOT_NM') == 1;
    }
}
