<?php
namespace Modules\API\APIInterne\OxaMobility\Repository;

use Entity\Model\Articles;
use Entity\Model\Paravrac;
use Entity\Model\SousFamille;
use Helpers\QueryBuilder\AbsRepository;

class CdeComptoirRepo extends AbsRepository
{

    /**
     * @return array<mixed>
     */
    public function getCommandeLigne() :array
    {
        $articleCdeComptoir =
            (new Paravrac($this->pdo))
                ->getValue('OXAMPROC', 'CDE_COMPTOIR_PAR_MONTANT_CODE_ART');
        // TODO : merge query
        $article = (new Articles($this->pdo))->find($articleCdeComptoir);
        return [
            'CODE_ART' => $articleCdeComptoir,
            'SousFamille' => (new SousFamille($this->pdo))->find($article['SSFAM']),
        ];
    }
}
