<?php

declare(strict_types=1);

namespace App\Administration\Domain\Model\Import;

/**
 * Champs Classeo disponibles pour le mapping d'import élèves.
 */
enum StudentImportField: string
{
    case LAST_NAME = 'lastName';
    case FIRST_NAME = 'firstName';
    case FULL_NAME = 'fullName';
    case EMAIL = 'email';
    case CLASS_NAME = 'className';
    case BIRTH_DATE = 'birthDate';
    case GENDER = 'gender';
    case STUDENT_NUMBER = 'studentNumber';

    public function estObligatoire(): bool
    {
        return match ($this) {
            self::LAST_NAME, self::FIRST_NAME, self::CLASS_NAME => true,
            default => false,
        };
    }

    public function label(): string
    {
        return match ($this) {
            self::LAST_NAME => 'Nom',
            self::FIRST_NAME => 'Prénom',
            self::FULL_NAME => 'Nom complet (NOM Prénom)',
            self::EMAIL => 'Email',
            self::CLASS_NAME => 'Classe',
            self::BIRTH_DATE => 'Date de naissance',
            self::GENDER => 'Genre',
            self::STUDENT_NUMBER => 'Numéro élève',
        };
    }

    /**
     * @return list<self>
     */
    public static function champsObligatoires(): array
    {
        return array_values(array_filter(
            self::cases(),
            static fn (self $field): bool => $field->estObligatoire(),
        ));
    }
}
