<?php

declare(strict_types=1);

namespace CliqThemes\StoreLocator\Support;

defined('ABSPATH') || exit;

/**
 * The icons a category can be given, as a fixed read-only set.
 *
 * Read-only because these are files packaged with the plugin: an author picks
 * one and recolours it, rather than uploading or editing the artwork.
 *
 * This is intentionally independent from the marker library: it contains
 * no marker shapes, composition code, editor configuration, or full glyph
 * catalogue.
 */
final class CategoryIconLibrary
{
    /**
     * @return array{glyphs: array<int, array{slug:string,name:string,color:string,glyph:string}>, shapes: array{}}
     */
    public static function assets(): array
    {
        $stroke = 'stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
        $fill = 'fill="currentColor"';

        $icons = [
            'store' => ['Store', '#3858e9', '<path d="M11 14h10v8H11z" ' . $stroke . '/><path d="M10 14l1.5-4h9l1.5 4" ' . $stroke . '/>'],
            'home' => ['Home', '#0ea5e9', '<path d="M10 16l6-5 6 5M12 15v7h8v-7" ' . $stroke . '/>'],
            'restaurant' => ['Restaurant', '#ea580c', '<path d="M13 10v5m0 0v7m-1.5-12v3.5a1.5 1.5 0 0 0 3 0V10" ' . $stroke . '/><path d="M20 10c-1.2 0-2 1.4-2 3.2 0 1.4.8 2.2 2 2.4V22" ' . $stroke . '/>'],
            'hotel' => ['Hotel', '#0284c7', '<path d="M11 14v6M11 17h7a2 2 0 0 1 2 2v1M11 21h10" ' . $stroke . '/><circle cx="14" cy="15.5" r="1.2" ' . $stroke . '/>'],
            'shopping' => ['Shopping', '#db2777', '<path d="M12 13h8l-1 9h-6z" ' . $stroke . '/><path d="M14 13a2 2 0 0 1 4 0" ' . $stroke . '/>'],
            'car' => ['Car', '#1d4ed8', '<path d="M10 18l1.5-4.5h9L22 18v3h-2v-1.5h-8V21h-2z" ' . $stroke . '/><circle cx="13" cy="18.5" r="1" ' . $fill . '/><circle cx="19" cy="18.5" r="1" ' . $fill . '/>'],
            'medical' => ['Medical', '#dc2626', '<path d="M11 13h3v-3h4v3h3v4h-3v3h-4v-3h-3z" ' . $fill . '/>'],
            'office' => ['Office', '#475569', '<path d="M11 10h10v12h-10z" ' . $stroke . '/><path d="M13.5 13h1.5M17 13h1.5M13.5 16h1.5M17 16h1.5M14.5 22v-3h3v3" ' . $stroke . '/>'],
            'park' => ['Park', '#16a34a', '<path d="M16 11c-2.5 0-4 2-4 4 0 2 2 3 4 3s4-1 4-3c0-2-1.5-4-4-4z" ' . $stroke . '/><path d="M16 18v4" ' . $stroke . '/>'],
            'info' => ['Information', '#2563eb', '<circle cx="16" cy="16" r="6" ' . $stroke . '/><path d="M16 15v4" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/><circle cx="16" cy="12.6" r="1" ' . $fill . '/>'],
        ];

        $glyphs = [];
        foreach ($icons as $slug => [$name, $color, $glyph]) {
            $glyphs[] = compact('slug', 'name', 'color', 'glyph');
        }

        return ['glyphs' => $glyphs, 'shapes' => []];
    }
}
