<?php

declare(strict_types=1);

namespace App\Administration\Domain\Model\Import;

use function array_filter;
use function array_values;

/**
 * Champs Classeo disponibles pour le mapping d'import d'invitations parents.
 */
enum ParentInvitationImportField: string
{
    case STUDENT_NAME = 'studentName';
    case EMAIL_1 = 'email1';
    case EMAIL_2 = 'email2';

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

    public function label(): string
    {
        return match ($this) {
            self::STUDENT_NAME => 'Nom élève',
            self::EMAIL_1 => 'Email parent 1',
            self::EMAIL_2 => 'Email parent 2',
        };
    }

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