<?php
namespace Modules\Fournisseur\Rules;

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

class ModificationSourceExt
{
    /** @var ServerRequestInterFace $request */
    protected ServerRequestInterface $request;
    
    /** @var \PDO $pdo */
    protected \PDO $pdo;
    
    public function __construct(ServerRequestInterface $request, \PDO $pdo)
    {
        $this->request  = $request;
        $this->pdo      = $pdo;
    }

    /**
     * init
     *
     * @return bool
     */
    public function init(): bool
    {
        $droit = Roles::droitsUtilMulti($this->pdo, [
            'HA_FOU_MOD',
            'HA_PRO_MOD',
        ]);
        return $droit['HA_FOU_MOD'] || $droit['HA_PRO_MOD'];
    }

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

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