<?php

namespace Modules\Evaluation\Rules;

use Psr\Http\Message\ServerRequestInterface;

class BibliothequeDeQuestions
{
    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 ajoutTheme(): bool
    {
        $mode = $this->request->getAttribute('mode');
        if (!$this->main->questionnaireCreatEditAccess() && ($mode == 'question' || $mode == 'modele' || $mode == 'campagne')) {
            return false;
        }

        return true;
    }

    public function supprimerTheme(): bool
    {
        $mode = $this->request->getAttribute('mode');
        if (!$this->main->questionnaireCreatEditAccess() && ($mode == 'question' || $mode == 'modele' || $mode == 'campagne')) {
            return false;
        }

        return true;
    }

    public function modifierTheme(): bool
    {
        $mode = $this->request->getAttribute('mode');
        if (!$this->main->questionnaireCreatEditAccess() && ($mode == 'question' || $mode == 'modele' || $mode == 'campagne')) {
            return false;
        }

        return true;
    }

    public function reset(): bool
    {
        $mode = $this->request->getAttribute('mode');
        if (!$this->main->questionnaireCreatEditAccess() && ($mode == 'question' || $mode == 'modele' || $mode == 'campagne')) {
            return false;
        }

        return true;
    }
}
