<?php

namespace Modules\Facture\Rules;

use Helpers\Outil\Roles;
use Psr\Http\Message\ServerRequestInterface;

class Zedoc
{
    protected ServerRequestInterface $request;
    protected \PDO $pdo;
    protected Main $main;

    public function __construct(ServerRequestInterface $request, \PDO $pdo)
    {
        $this->request    = $request;
        $this->pdo        = $pdo;
        $this->main       = new Main($this->request, $this->pdo);
    }
    public function zedoc(): bool
    {
        return Roles::droitsUtilisateur($this->pdo, 'HA_FA_LAD') || Roles::droitsUtilisateur($this->pdo, 'HA_FA_LADA');
    }

    public function affichagPDFLAD(): bool
    {
        return true;
    }

    public function listRejected(): bool
    {
        return Roles::droitsUtilisateur($this->pdo, 'HA_FA_LAD') || Roles::droitsUtilisateur($this->pdo, 'HA_FA_LADA');
    }
    
    public function affichagPDFJRejected(): bool
    {
        return Roles::droitsUtilisateur($this->pdo, 'HA_FA_LAD') || Roles::droitsUtilisateur($this->pdo, 'HA_FA_LADA');
    }
    
    public function ajaxActionRejected(): bool
    {
        return Roles::droitsUtilisateur($this->pdo, 'HA_FA_LAD') || Roles::droitsUtilisateur($this->pdo, 'HA_FA_LADA');
    }
    public function zedocBBA(): bool
    {
        return Roles::droitsUtilisateur($this->pdo, 'HA_FA_LAD') || Roles::droitsUtilisateur($this->pdo, 'HA_FA_LADA');
    }

    /**
     * @return bool
     */
    // @phpcs:ignore
    public function ajaxRejected(): bool
    {
        return true;
    }
}
