<?php

declare(strict_types=1);

namespace App\Framework\Discovery\Events;

use App\Framework\Core\ValueObjects\Timestamp;
use App\Framework\Discovery\ValueObjects\ScanType;

/**
 * Event fired when discovery process starts
 */
final readonly class DiscoveryStartedEvent
{
    public function __construct(
        public int $estimatedFiles,
        public array $directories,
        public ScanType $scanType,
        public Timestamp $timestamp
    ) {
    }

    public function toArray(): array
    {
        return [
            'estimated_files' => $this->estimatedFiles,
            'directories' => $this->directories,
            'scan_type' => $this->scanType->value,
            'scan_type_description' => $this->scanType->getDescription(),
            'timestamp' => $this->timestamp->toFloat(),
        ];
    }
}
