<?php

namespace Modules\GlobalApplication\Repository;

class ContactsFournisseur
{
    
    private $pdo;
    
    public function __construct(\PDO $pdo)
    {
        $this->pdo = $pdo;
    }
    
    /**
     * lastContact
     * @param string $codeFou
     * @return array<string>
     */
    public function lastContact(string $codeFou) : ?array
    {
        $req = "SELECT MAX(IND_FOU) MAX_IND_FOU
            FROM CONTFOUR with (nolock)
            WHERE CONTFOUR.CODE_FOU = :codeFou";
        
        $arrayReq = [
            ':codeFou' => $codeFou,
        ];
        
        $nbr = $this->pdo->prepare($req);
        $nbr->execute($arrayReq);
        return $nbr->fetch($this->pdo::FETCH_ASSOC);
    }
}
