<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\DI\Compiler\Factory;

final class FactoryGenerationSummary
{
    public function __construct(
        private readonly int $attempted,
        private readonly int $generated,
        private readonly int $failed,
        private readonly array $results = []
    ) {}

    public function attempted(): int { return $this->attempted; }
    public function generated(): int { return $this->generated; }
    public function failed(): int { return $this->failed; }
    public function results(): array { return $this->results; }

    public function toArray(): array
    {
        return [
            'attempted' => $this->attempted,
            'generated' => $this->generated,
            'failed' => $this->failed,
            'results' => array_map(static fn ($r): array => $r->toArray(), $this->results),
        ];
    }
}
