<?php

namespace App\Application\Admin;

use App\Framework\Attributes\Route;
use App\Framework\Auth\Auth;
use App\Framework\Cache\Cache;
use App\Framework\Discovery\Results\DiscoveryResults;
use App\Framework\View\TemplateDiscoveryVisitor;

class ShowDiscovery
{
    public function __construct(
        private DiscoveryResults $results,
    )
    {
    }

    #[Auth]
    #[Route('/admin/discovery')]
    public function show(
        #Cache $cache
    )
    {
        $attributes = $this->results->getAllAttributeResults();

        foreach ($attributes as $name => $attribute) {
            echo "Attribute: $name <br/>";
            echo "<ul>";
            foreach ($attribute as $result) {
                echo "<li>" . $result['class'] . '::'.($result['method'] ?? '').'()</li>';
            };
            echo "</ul>";
        };

    }
}
