<?php
/**
 * Governance diagnostic ability schemas.
 *
 * @package LolaCoreForBricks
 */

declare(strict_types=1);

namespace LolaCoreForBricks\Schemas;

use LolaCoreForBricks\AbilitiesProvider;
use LolaCoreForBricks\Governance\ClassSimilarity;

/**
 * Door 1 schema definitions for governance diagnostics.
 */
class GovernanceSchemas
{
    /**
     * @return array<string, array<string, mixed>>
     */
    public static function define(): array
    {
        return [
            'findUnusedClasses' => [
                'description' => 'Find global classes with no indexed usage. Always includes coverage; partial coverage is declared before results.',
                'category'    => AbilitiesProvider::CATEGORY,
                'keywords'    => [
                    'exact' => ['unused classes', 'dead classes', 'clases muertas', 'clases sin uso'],
                    'stem'  => ['unused', 'dead', 'orphan'],
                ],
                'parameters'  => [
                    'type'       => 'object',
                    'properties' => array_merge(SchemaPagination::properties(), [
                        'include_trash' => ['type' => 'boolean'],
                    ]),
                ],
            ],
            'findDuplicateClasses' => [
                'description' => 'Find groups of global classes with equivalent normalized settings above a similarity threshold. Includes keeper recommendation.',
                'category'    => AbilitiesProvider::CATEGORY,
                'keywords'    => [
                    'exact' => ['duplicate classes', 'merge classes', 'clases duplicadas'],
                    'stem'  => ['duplicate', 'merge', 'similar'],
                ],
                'parameters'  => [
                    'type'       => 'object',
                    'properties' => array_merge(SchemaPagination::properties(), [
                        'threshold' => [
                            'type'        => 'number',
                            'description' => 'Similarity percentage required to group classes (default ' . ClassSimilarity::DEFAULT_THRESHOLD . ').',
                        ],
                    ]),
                ],
            ],
            'findUnusedVariables' => [
                'description' => 'Find global variables with no indexed references.',
                'category'    => AbilitiesProvider::CATEGORY,
                'keywords'    => [
                    'exact' => ['unused variables', 'variables sin uso'],
                    'stem'  => ['variable', 'unused'],
                ],
                'parameters'  => [
                    'type'       => 'object',
                    'properties' => SchemaPagination::properties(),
                ],
            ],
            'findOrphanComponents' => [
                'description' => 'Find Bricks components with zero indexed instances.',
                'category'    => AbilitiesProvider::CATEGORY,
                'keywords'    => [
                    'exact' => ['orphan components', 'unused components', 'componentes huérfanos'],
                    'stem'  => ['orphan', 'component'],
                ],
                'parameters'  => [
                    'type'       => 'object',
                    'properties' => SchemaPagination::properties(),
                ],
            ],
            'findThemeStyleConflicts' => [
                'description' => 'Find theme style pairs whose conditions can apply to the same page, with concrete example pages.',
                'category'    => AbilitiesProvider::CATEGORY,
                'keywords'    => [
                    'exact' => ['theme style conflicts', 'overlapping theme styles', 'conflictos theme style'],
                    'stem'  => ['conflict', 'overlap', 'theme style'],
                ],
                'parameters'  => [
                    'type'       => 'object',
                    'properties' => SchemaPagination::properties(),
                ],
            ],
        ];
    }
}
