<?php
/**
 * AbilitiesProvider — injects Bricks tool schemas into LolaCore.
 *
 * @package LolaCoreForBricks
 */

declare(strict_types=1);

namespace LolaCoreForBricks;

use LolaCoreForBricks\Schemas\ClassSchemas;
use LolaCoreForBricks\Schemas\ClassWriteSchemas;
use LolaCoreForBricks\Schemas\CompositionSchemas;
use LolaCoreForBricks\Schemas\ContentShortcutSchemas;
use LolaCoreForBricks\Schemas\ConventionSchemas;
use LolaCoreForBricks\Schemas\DesignSystemWriteSchemas;
use LolaCoreForBricks\Schemas\ComponentSchemas;
use LolaCoreForBricks\Schemas\ComponentWriteSchemas;
use LolaCoreForBricks\Schemas\ElementSchemas;
use LolaCoreForBricks\Schemas\ElementStyleSchemas;
use LolaCoreForBricks\Schemas\GovernanceSchemas;
use LolaCoreForBricks\Schemas\IndexSchemas;
use LolaCoreForBricks\Schemas\OperatingGuideSchemas;
use LolaCoreForBricks\Schemas\PageBehaviorSchemas;
use LolaCoreForBricks\Schemas\OrientationSchemas;
use LolaCoreForBricks\Schemas\TemplateSchemas;
use LolaCoreForBricks\Schemas\TemplateWriteSchemas;
use LolaCoreForBricks\Schemas\ThemeStyleSchemas;
use LolaCoreForBricks\Schemas\VariableSchemas;
use LolaCoreForBricks\Schemas\WooSurfaceSchemas;
use LolaCoreForBricks\Schemas\BatchCompositionSchemas;

/**
 * Door 1 — LLM tool schemas (camelCase keys).
 */
class AbilitiesProvider
{
    public const CATEGORY = 'bricks';

    public function register(): void
    {
        add_filter('lolacore_available_abilities', [$this, 'injectAbilities'], 10, 1);
    }

    /**
     * @param array<string, array<string, mixed>> $abilities
     * @return array<string, array<string, mixed>>
     */
    public function injectAbilities(array $abilities): array
    {
        return array_merge(
            $abilities,
            OrientationSchemas::define(),
            IndexSchemas::define(),
            ClassSchemas::define(),
            ClassWriteSchemas::define(),
            DesignSystemWriteSchemas::define(),
            ConventionSchemas::define(),
            VariableSchemas::define(),
            ThemeStyleSchemas::define(),
            ComponentSchemas::define(),
            ComponentWriteSchemas::define(),
            PageBehaviorSchemas::define(),
            TemplateSchemas::define(),
            TemplateWriteSchemas::define(),
            ElementSchemas::define(),
            CompositionSchemas::define(),
            ElementStyleSchemas::define(),
            ContentShortcutSchemas::define(),
            OperatingGuideSchemas::define(),
            GovernanceSchemas::define(),
            BatchCompositionSchemas::define(),
            BricksEnv::isWooCommerceActive() ? WooSurfaceSchemas::define() : []
        );
    }
}
