<?php

namespace Entity\Model\Alias;

use Entity\Model\Paravrac;

class ParamUtilisateur extends Paravrac
{
    public function hasSupHierChoice() :bool
    {
        return $this->getFlag('OXAPROC', 'CHOIX_SUPHIER');
    }

    public function hasUOChoice() :bool
    {
        return $this->getFlag('OXAPROC', 'CHOIX_UO');
    }

    public function hasSmtpChoice() :bool
    {
        return ! $this->getFlag('OXAPROC', 'PROFILUSER_MASQ_CPT_SMTP');
    }
    
    public function hasEprocDemande() :bool
    {
        return ! $this->getFlag('OXAPROC', 'MASQUER_EPROC_DEMANDE');
    }
    public function isPasswordForSignActivated() :bool
    {
        return $this->getFlag('PARAMGEN', 'MDP_LOG_DIF_SIG')
            && ! $this->getFlag('PARAMGEN', 'PAS_DE_MDP_SIG');
    }

    /**
     * @_return array{MDP_A_CS:bool,MDP_A_MAJ:bool,MDP_A_MIN:bool,MDP_A_CHI:bool,LONG_MINI_MDP:int}
     * @return array<mixed>
     */
    public function listPasswordRule() :array
    {
        $m = [];
        foreach (['MDP_A_CS','MDP_A_MAJ', 'MDP_A_MIN', 'MDP_A_CHI'] as $key) {
            $m[ $key ] = $this->getFlag('PARAMGEN', $key);
        }
        $m['LONG_MINI_MDP'] = intval($this->getValue('PARAMGEN', 'LONG_MINI_MDP') ?? 0);
        return $m;
    }
}
