<?php

declare(strict_types=1);

namespace App\Framework\Logging;

use App\Framework\Core\PathProvider;
use App\Framework\DI\Initializer;
use App\Framework\Logging\ValueObjects\LogViewerConfig;

final readonly class LogViewerInitializer
{
    #[Initializer]
    public function __invoke(PathProvider $pathProvider): LogViewer
    {
        // Erstelle LogConfig für zentrale Pfadverwaltung (legacy)
        $logConfig = new LogConfig($pathProvider);

        // Baue LogViewerConfig VO aus LogConfig
        $storageLogsPath = $pathProvider->resolvePath('storage/logs');

        $config = new LogViewerConfig(
            storageLogsPath: $storageLogsPath,
            logDirectories: ['app', 'debug', 'security'],
            defaultLimit: 100
        );

        return new LogViewer($config);
    }
}
