<?php

namespace Calio\Support;

if (!defined('ABSPATH')) {
    exit;
}

/**
 * Defines extension metadata so admin UI and runtime registration share one source.
 */
final class ExtensionCatalog
{
    /**
     * Returns every extension exposed by Calio.
     *
     * @return array<string, array<string, string|bool>>
     */
    public static function all(): array
    {
        return [
            'smooth_scroll' => [
                'title' => 'Smooth Scroll',
                'class' => '\\CalioPro\\Extensions\\SmoothScrollExtension',
                'summary' => 'Global smooth scroll runtime for polished scrolling across the live frontend.',
                'status' => 'Stable',
                'focus' => 'Global motion',
                'tier' => 'pro',
                'default' => false,
            ],
            'scroll_fill_effect' => [
                'title' => 'Scroll Fill Effect',
                'class' => '\\Calio\\Extensions\\ScrollFillEffectExtension',
                'summary' => 'Scroll-driven text fill for headings and copy.',
                'status' => 'Experimental',
                'focus' => 'Scroll motion',
                'default' => true,
            ],
            'wrapper_link' => [
                'title' => 'Wrapper Link',
                'class' => '\\Calio\\Extensions\\WrapperLinkExtension',
                'summary' => 'Wrapper-level click surfaces with nested action safety.',
                'status' => 'Stable',
                'focus' => 'Click surfaces',
                'default' => true,
            ],
            'reveal_parallax' => [
                'title' => 'Reveal / Parallax',
                'class' => '\\Calio\\Extensions\\RevealParallaxExtension',
                'summary' => 'Reveal motion and parallax drift for Elementor wrappers.',
                'status' => 'Experimental',
                'focus' => 'Motion utility',
                'default' => true,
            ],
            'glass_filter' => [
                'title' => 'Glass Filter',
                'class' => '\\Calio\\Extensions\\GlassFilterExtension',
                'summary' => 'Backdrop blur and liquid glass surface effects for Elementor wrappers.',
                'status' => 'Stable',
                'focus' => 'Visual effects',
                'default' => true,
            ],
            'sticky_content' => [
                'title' => 'Sticky Content',
                'class' => '\\Calio\\Extensions\\StickyContentExtension',
                'summary' => 'Sticky positioning with offsets, guards and active-state styling.',
                'status' => 'Experimental',
                'focus' => 'Sticky utility',
                'default' => true,
            ],
        ];
    }

    /**
     * Returns default enabled states for extension settings.
     *
     * @return array<string, bool>
     */
    public static function defaults(): array
    {
        $defaults = [];

        foreach (self::all() as $slug => $extension) {
            $defaults[$slug] = !empty($extension['default']);
        }

        return $defaults;
    }
}
