<?php

namespace Modules\DemandeAchat\Outil;

use Helpers\Trad\ITrad;

class FormArray
{
    /**
     * getTabJourAppli
     *
     * @return array<mixed>
     */
    public static function getTabJourAppli(): array
    {
        $array = [];
        for ($i = 1; $i < 32; $i++) {
            $array[$i] = $i;
        }

        return $array;
    }

    /**
     * getFormArrays
     *
     * @param  ITrad $trad
     * @return array<mixed>
     */
    public static function getFormArrays(ITrad $trad): array
    {
        $tabPeriodicite = [
            'M' => $trad->t('Mensuelle'),
            'T' => $trad->t('Trimestrielle'),
            'S' => $trad->t('Semestrielle'),
            'A' => $trad->t('Annuelle'),
        ];

        $tabPeriode = [
            'D' => $trad->t('Début de période'),
            'F' => $trad->t('Fin de période'),
        ];

        $array = [];
        for ($i = 1; $i < 32; $i++) {
            $array[$i] = $i;
        }

        $tabJoursAppli = $array;

        $tabTypeMarchePublic = [
            '' => '',
            'C' => $trad->t('Continu'),
            'R' => $trad->t('Récurrent'),
            'U' => $trad->t('Unique')
        ];

        $tabTypeDate = [
            'D' => $trad->t('Date'),
            'S' => $trad->t('Semaine'),
            'M' => $trad->t('Mois'),
        ];

        $typeChiffExec = [
            'E' => $trad->t('Exécution'),
            'C' => $trad->t('Chiffrage'),
        ];

        $listeEtatDA = [
            '' => $trad->t('Toutes'),
            'AV' => $trad->t('À valider'),
            'ES' => $trad->t('En signature'),
            'AT' => $trad->t('À traiter'),
            'ao_pending' => $trad->t('Consultation en cours'),
            'consult_terminer' => $trad->t('Consultation terminée'),
            'a_commander' => $trad->t('À commander'),
            'R' => $trad->t('Refusée'),
            'T' => $trad->t('Traitée'),
        ];

        return [
            'tabPeriodicite' => $tabPeriodicite,
            'tabPeriode' => $tabPeriode,
            'tabJoursAppli' => $tabJoursAppli,
            'tabTypeMarchePublic' => $tabTypeMarchePublic,
            'typeChiffExec' => $typeChiffExec,
            'tabTypeDate' => $tabTypeDate,
            'listeEtatDA' => $listeEtatDA
        ];
    }

    /**
     * @return array<string,string>
     */
    public static function listEtatDa(ITrad $trad)
    {
        return self::getFormArrays($trad)['listeEtatDA'];
    }
}
