<?php

namespace Modules\Stock\Repository;

use Helpers\QueryBuilder\AbsRepository;

class StockGlobalSocieteRepo extends AbsRepository
{
    /**
     * @param string $codeArt
     * @return array<int,array<string,string>>
     */
    public function findAllFromCodeArt(string $codeArt): array
    {
        $req = "SELECT 
                    STG.*,
                    SA.UNITE_ACH AS UNITE_ACH,
                    SOC.DEVISE AS DEVISE,
                    SOC.RAIS_SOC AS RAIS_SOC
                FROM STGLOSTE STG
                LEFT JOIN SARTICLE SA ON STG.CODE_ART = SA.CODE_ART
                LEFT JOIN SOCIETE SOC ON STG.CODE_STE = SOC.CODE_STE
                WHERE STG.CODE_ART=:codeArt";

        $arrayReq = [
            'codeArt' => $codeArt
        ];

        return $this->fetchAssocAll($req, $arrayReq);
    }
}
