<?php

declare(strict_types=1);

namespace App\Administration\Domain\Model\Import;

/**
 * Statut du cycle de vie d'un lot d'import.
 */
enum ImportStatus: string
{
    case PENDING = 'pending';
    case PROCESSING = 'processing';
    case COMPLETED = 'completed';
    case FAILED = 'failed';

    public function peutDemarrer(): bool
    {
        return $this === self::PENDING;
    }

    public function estTermine(): bool
    {
        return $this === self::COMPLETED || $this === self::FAILED;
    }

    public function label(): string
    {
        return match ($this) {
            self::PENDING => 'En attente',
            self::PROCESSING => 'En cours',
            self::COMPLETED => 'Terminé',
            self::FAILED => 'Échoué',
        };
    }
}
