<?php

namespace Entity\Model;

use Helpers\Outil\Sql;
use Helpers\QueryBuilder\QueryBuilder;
use Modules\Stock\Helper\StringHelper;

class Sstocklo extends QueryBuilder
{
    protected string $table = 'SSTOCKLO with (nolock)';
    protected string $primaryKey = '';
    protected array $primKey = ['SITE', 'CODE_ART'];

    /**
     * @param array<string,mixed> $stockLocal
     * @return void
     */
    public function processAndMerge(array $stockLocal): void
    {
        $stockLocal['MVT_VERR'] = Sql::toBool($stockLocal['MVT_VERR']);
        StringHelper::toFloat($stockLocal, ['QTE_PHYS', 'QTE_RES', 'QTE_PREV', 'QTE_INDIS', 'QTE_REAP',
        'QTE_LIV', 'QTE_ACHEM', 'STK_PRO', 'CONSO_ANU', 'QTE_MAX', 'QTE_ECO']);

        $this->merge($stockLocal);
    }
}
