<?php
namespace Modules\Utilisateur\Rules;

use Entity\Model\Utilcreate;
use Psr\Http\Message\ServerRequestInterface;

// @phpcs:ignore
class Profile
{
    /** @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;
    }


    /**
     * @return bool
     */
    public function formEdit(): bool
    {
        return true;
    }

    /**
     * @return bool
     */
    public function editPassword(): bool
    {
        return true;
    }

    /**
     * @return bool
     */
    public function edit(): bool
    {
        return true;
    }

    /**
     * @return bool
     */
    // @phpcs:ignore
    public function suiviCompte(): bool
    {
        $findCreation = (new Utilcreate($this->pdo))->find([
            'CODE' => $_SESSION['REF_DEMANDE']??null,
            'EMAIL' => $_SESSION['ID_TMP']??null
        ]);

        if ($_SESSION["Session_Login"] || $findCreation) {
            return true;
        }
        return false;
    }
}
