<?php

namespace Modules\Contrat\Validator;

use Entity\Model\Centre;
use Helpers\Outil\Sql;
use Helpers\Validator\Validator;

class RFAValidator extends Validator
{
    /**
     * @param array<mixed> $post
     * @return void
     */
    public function entete(&$post) : void
    {
        $this->isStringAvecEspace($this->trad->t('Libellé'), $post['LIBELLE'], 1, 120);
        $this->isDate($post['DTE_DEBUT'], '', '', true, $this->trad->t('date de début'));
        $this->isDate($post['DTE_FIN'], '', '', true, $this->trad->t('date de fin'));
        $this->isCoherenceDate($post['DTE_DEBUT'], $post['DTE_FIN'], $this->trad->t('date de fin'));
        $this->isCheck($post['SOLDE']);
        $this->isCheck($post['TACITE_RECOND']);
        $this->isStringAvecEspace($this->trad->t('Commentaire'), $post['COMMENTAIRE'], 0, 3000);
        $this->ligne($post);
    }

    /**
     * @param array<mixed> $post
     * @return void
     */
    public function ligne(&$post):void
    {
        $this->isFloat($this->trad->t('Valeur'), $post['VALEUR_RFA'], 13.2, true);
    }
}
