<?php

namespace Modules\DemandeAchat\Rules;

use Psr\Http\Message\ServerRequestInterface;

class PopupChoixCreationDemandeAchat
{
    /** @var ServerRequestInterface $request */
    // @phpstan-ignore-next-line
    private ServerRequestInterface $request;

    /** @var \PDO $pdo */
    // @phpstan-ignore-next-line
    private \PDO $pdo;

    /** @var array<mixed> $droits */
    private array $droits;

    /**
     * @param ServerRequestInterface $request
     * @param \PDO $pdo
     */
    public function __construct(ServerRequestInterface $request, \PDO $pdo)
    {
        $this->request              = $request;
        $this->pdo                  = $pdo;
        $this->droits               = [
            'DA_CreatModif' => $_SESSION['DA_CreatModif'] ?? null
        ];
    }

    /**
     * @return bool
     */
    public function choixCreation(): bool
    {
        if (!$this->droits['DA_CreatModif']) {
            return false;
        }

        return true;
    }
}
