<?php

declare(strict_types=1);

namespace App\Administration\Domain\Model\Import;

/**
 * Champs Classeo disponibles pour le mapping d'import enseignants.
 *
 * @see FR77: Import enseignants via CSV
 */
enum TeacherImportField: string
{
    case LAST_NAME = 'lastName';
    case FIRST_NAME = 'firstName';
    case EMAIL = 'email';
    case SUBJECTS = 'subjects';
    case CLASSES = 'classes';

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

    public function estMultiValeur(): bool
    {
        return match ($this) {
            self::SUBJECTS, self::CLASSES => true,
            default => false,
        };
    }

    public function label(): string
    {
        return match ($this) {
            self::LAST_NAME => 'Nom',
            self::FIRST_NAME => 'Prénom',
            self::EMAIL => 'Email',
            self::SUBJECTS => 'Matières',
            self::CLASSES => 'Classes',
        };
    }

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