<?php
declare(strict_types=1);

namespace App\Core\Registries;

final class ReportRegistry
{
    private static array $items = [];

    public static function register(string $key, array $definition): void
    {
        self::$items[$key] = $definition;
    }

    public static function get(string $key): ?array
    {
        return self::$items[$key] ?? null;
    }

    public static function getAll(): array
    {
        return self::$items;
    }

    public static function getByCategory(string $category): array
    {
        return array_filter(self::$items, fn($item) => ($item['category'] ?? '') === $category);
    }

    public static function has(string $key): bool
    {
        return isset(self::$items[$key]);
    }
}