<?php

declare(strict_types=1);

namespace apexl\Io\modules\menu\collections;

use apexl\Io\modules\menu\interfaces\NavFilterInterface;

/**
 * Ordered bag of NavFilterInterface implementations, collected via the
 * `menu.collectNavFilters` hook (see NavFilterRegistry). Order is
 * registration order — the first filter added sees the raw
 * permission-checked menu, each subsequent filter sees the previous
 * filter's output.
 */
final class NavFilterCollection
{
    /** @var NavFilterInterface[] */
    private array $filters = [];

    public function add(NavFilterInterface $filter): self
    {
        $this->filters[] = $filter;
        return $this;
    }

    /** @return NavFilterInterface[] */
    public function all(): array
    {
        return $this->filters;
    }
}
