<?php

namespace Modules\Stock\Repository;

use Helpers\QueryBuilder\AbsRepository;
use Modules\Stock\Trait\Repo\LigneRepoTrait;

class LigneBonTransfertRepo extends AbsRepository
{
    use LigneRepoTrait;

    /**
     * @return array<int, array<string, mixed>>
     */
    public function findAllFromNoBt(string $noBt): array
    {
        $requete = "SELECT 
                        SL.*,
                        SA.DESIGN AS ART_DESIGN,
                        SA.UNITE_STK AS UNITE_STK
                    FROM SBT_LIGN SL with (nolock)
                    LEFT JOIN SARTICLE SA ON SL.CODE_ART = SA.CODE_ART
                    WHERE SL.NO_BT = :noBt
                    ORDER BY SL.NO_LIG ASC
        ";

        return $this->fetchAssocAll($requete, [':noBt' => $noBt]);
    }
}
