<?php

declare(strict_types=1);

namespace App\Framework\LiveComponents\ValueObjects;

/**
 * Scan Status
 *
 * Status eines Virus-/Malware-Scans.
 */
enum ScanStatus: string
{
    case CLEAN = 'clean';           // File is clean, no threats detected
    case INFECTED = 'infected';     // File contains malware/virus
    case SUSPICIOUS = 'suspicious'; // File exhibits suspicious behavior
    case ERROR = 'error';          // Scan failed due to error

    /**
     * Check if status indicates file is safe
     */
    public function isSafe(): bool
    {
        return $this === self::CLEAN;
    }

    /**
     * Check if status indicates file is dangerous
     */
    public function isDangerous(): bool
    {
        return in_array($this, [self::INFECTED, self::SUSPICIOUS]);
    }

    /**
     * Get human-readable description
     */
    public function getDescription(): string
    {
        return match ($this) {
            self::CLEAN => 'File is clean and safe to use',
            self::INFECTED => 'File contains malicious content',
            self::SUSPICIOUS => 'File exhibits suspicious behavior',
            self::ERROR => 'Scan could not be completed',
        };
    }
}
