<?php
declare(strict_types=1);

namespace PpPhp\Resources\Icons\HeroIcons;

use PpPhp\Core\IconManager\IconDefinition;
use PpPhp\Core\IconManager\IconSearch;
use PpPhp\Core\Resources\Contracts\ResourcePackInterface;

final class Pack implements ResourcePackInterface
{
    public static function id(): string { return 'heroicons'; }
    public static function label(): string { return 'Heroicons'; }
    public static function type(): string { return 'icons'; }
    public static function version(): string { return '1.0.0'; }

    public static function metadata(): array
    {
        return ['family' => 'heroicons'];
    }

    public static function assets(): array
    {
        return [
            'css' => [],
            'js' => [],
        ];
    }

    /** @return array<int, IconDefinition> */
    public static function icons(): array
    {
        return [

            new IconDefinition(
                name: 'hero-user',
                label: 'User',
                pack: 'heroicons',
                family: 'heroicons',
                style: 'font',
                className: 'heroicon hero-user',
                categories: ['users'],
                aliases: ['person'],
                keywords: ['profile', 'account']
            ),

            new IconDefinition(
                name: 'hero-users',
                label: 'Users',
                pack: 'heroicons',
                family: 'heroicons',
                style: 'font',
                className: 'heroicon hero-users',
                categories: ['users'],
                aliases: ['group'],
                keywords: ['team', 'customers']
            ),

            new IconDefinition(
                name: 'hero-home',
                label: 'Home',
                pack: 'heroicons',
                family: 'heroicons',
                style: 'font',
                className: 'heroicon hero-home',
                categories: ['navigation'],
                aliases: ['house'],
                keywords: ['home']
            ),

            new IconDefinition(
                name: 'hero-cog',
                label: 'Cog',
                pack: 'heroicons',
                family: 'heroicons',
                style: 'font',
                className: 'heroicon hero-cog',
                categories: ['settings'],
                aliases: ['settings'],
                keywords: ['config']
            ),

            new IconDefinition(
                name: 'hero-chart-bar',
                label: 'Chart Bar',
                pack: 'heroicons',
                family: 'heroicons',
                style: 'font',
                className: 'heroicon hero-chart-bar',
                categories: ['dashboard'],
                aliases: ['chart'],
                keywords: ['analytics', 'report']
            ),

            new IconDefinition(
                name: 'hero-magnifying-glass',
                label: 'Magnifying Glass',
                pack: 'heroicons',
                family: 'heroicons',
                style: 'font',
                className: 'heroicon hero-magnifying-glass',
                categories: ['actions'],
                aliases: ['search'],
                keywords: ['find', 'search']
            ),

        ];
    }

    /** @return array<int, IconDefinition> */
    public static function search(string $query, int $limit = 100): array
    {
        return IconSearch::search(self::icons(), $query, $limit);
    }
}
