<?php

declare(strict_types=1);

/**
 * Minimal framework test without discovery system
 */

ini_set('display_errors', '1');
error_reporting(E_ALL);

require __DIR__ . '/../vendor/autoload.php';

try {
    echo "🌐 Minimal Framework Test\n";
    echo "========================\n\n";
    
    // Test basic framework components without discovery
    $pathProvider = new App\Framework\Core\PathProvider(__DIR__ . '/..');
    $clock = new App\Framework\DateTime\SystemClock();
    $memoryMonitor = new App\Framework\Performance\MemoryMonitor();
    
    echo "✅ PathProvider: " . $pathProvider->getBasePath() . "\n";
    echo "✅ Clock: " . $clock->now()->format('Y-m-d H:i:s') . "\n";
    echo "✅ Memory: " . number_format(memory_get_usage(true) / 1024 / 1024, 2) . " MB\n";
    
    // Test HTTP Request parsing
    $method = App\Framework\Http\Method::GET;
    echo "✅ HTTP Method: " . $method->value . "\n";
    
    // Simple HTTP response
    header('Content-Type: text/html; charset=utf-8');
    
    echo "\n📦 Framework Status:\n";
    echo "   • Basic components: ✅ Working\n";
    echo "   • Discovery system: 🚧 Needs optimization\n";
    echo "   • Performance: ⚡ {$memoryMonitor->getPeakMemoryUsageMb()}MB peak\n";
    
    echo "\n🎯 Next Steps:\n";
    echo "   1. Optimize discovery system for large codebase\n";
    echo "   2. Implement lazy loading for Framework components\n";
    echo "   3. Add performance monitoring\n";
    echo "   4. Test with production cache settings\n";
    
} catch (Throwable $e) {
    echo "❌ ERROR: " . $e->getMessage() . "\n";
    echo "   File: " . $e->getFile() . ":" . $e->getLine() . "\n";
    echo "   Class: " . get_class($e) . "\n";
    
    if (method_exists($e, 'getContext')) {
        echo "   Context: " . json_encode($e->getContext()) . "\n";
    }
}