<?php
/**
 * Canonical map for B3 governance abilities across Doors 2 and 3.
 *
 * @package LolaCoreForBricks
 */

declare(strict_types=1);

namespace LolaCoreForBricks;

/**
 * Single registry for governance diagnostic action metadata.
 */
final class GovernanceAbilityMap
{
    /**
     * @return array<string, array{handler: string, slug: string, label: string, description: string}>
     */
    public static function entries(): array
    {
        return [
            'find_unused_classes' => [
                'handler'     => 'findUnusedClasses',
                'slug'        => 'lolacore-bricks/find-unused-classes',
                'label'       => 'Find Unused Classes',
                'description' => 'Find global classes with no indexed usage.',
            ],
            'find_duplicate_classes' => [
                'handler'     => 'findDuplicateClasses',
                'slug'        => 'lolacore-bricks/find-duplicate-classes',
                'label'       => 'Find Duplicate Classes',
                'description' => 'Find groups of equivalent global classes.',
            ],
            'find_unused_variables' => [
                'handler'     => 'findUnusedVariables',
                'slug'        => 'lolacore-bricks/find-unused-variables',
                'label'       => 'Find Unused Variables',
                'description' => 'Find global variables with no indexed references.',
            ],
            'find_orphan_components' => [
                'handler'     => 'findOrphanComponents',
                'slug'        => 'lolacore-bricks/find-orphan-components',
                'label'       => 'Find Orphan Components',
                'description' => 'Find components with zero indexed instances.',
            ],
            'find_theme_style_conflicts' => [
                'handler'     => 'findThemeStyleConflicts',
                'slug'        => 'lolacore-bricks/find-theme-style-conflicts',
                'label'       => 'Find Theme Style Conflicts',
                'description' => 'Find overlapping theme style conditions with example pages.',
            ],
        ];
    }

    /**
     * @return string[]
     */
    public static function doorThreeSlugs(): array
    {
        return array_values(array_map(
            static fn (array $entry): string => $entry['slug'],
            self::entries()
        ));
    }
}
