<?php

declare(strict_types=1);

/*
 * This file is part of the Ferienpass package.
 *
 * (c) Richard Henkenjohann <richard@ferienpass.online>
 *
 * For more information visit the project website <https://ferienpass.online>
 * or the documentation under <https://docs.ferienpass.online>.
 */

namespace Ferienpass\AdminBundle\Cache;

use Ferienpass\AdminBundle\Form\Filter\Ttl;

final class FilterWithTtlRegistry
{
    /**
     * @param array<string, array{ttl: Ttl, views: list<string>}> $map
     *                                                                 filterKey => {ttl boundary, route views the filter applies to}
     */
    public function __construct(private readonly array $map = [])
    {
    }

    /**
     * @return array{ttl: Ttl, views: list<string>}|null
     */
    public function get(string $filterKey): ?array
    {
        return $this->map[$filterKey] ?? null;
    }
}
