<?php

namespace Entity\Model;

use Helpers\Outil\Sql;
use Helpers\QueryBuilder\QueryBuilder;
use PDO;

class Sparamet extends QueryBuilder
{
    protected string $table = 'SPARAMET with (nolock)';
    protected string $primaryKey = 'CLE';

    public function __construct(PDO $pdo)
    {
        parent::__construct($pdo);
        $this->primKey = ['CLE'];
    }

    /**
     * @param array<string,mixed> $parametreStock
     * @return void
     */
    public function processAndMerge(array $parametreStock): void
    {
        $parametreStock['INIT_QTE'] = Sql::toBool($parametreStock['INIT_QTE']);
        $parametreStock['MVTNADEPL'] = Sql::toBool($parametreStock['MVTNADEPL']);
        $parametreStock['PMPUNIQUE'] = Sql::toBool($parametreStock['PMPUNIQUE']);

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