<?php
namespace Helpers\View;

class Menu
{

    /**
     * @var array{icon:?string,label:string,notif?:int}[]|Menu[]
     */
    private array $menuItem;

    public function __construct()
    {
        $this->menuItem = [];
    }

    /**
     * @return array{icon:?string,label:string,notif?:int}[]|Menu[]
     */
    public function listItem() :array
    {
        return $this->menuItem;
    }

    /**
     * @param array<string|int> $routeParam
     */
    public function addLink(
        string $label,
        string $route,
        ?array $routeParam = null,
        ?string $icon = null,
        ?int $notif = null
    ) :self {
        $this->menuItem[] = [
            'route' => $route,
            'route_param' => $routeParam ?? [],
            'label' => $label,
            'icon' => $icon,
        ] + ($notif != null ? [
            'notif' => $notif,
        ] : []);

        return $this;
    }

    // private function addLinkPopup(
    //     string $label,
    //     string $route,
    //     ?array $routeParam = null,
    //     ?string $icon = null,
    //     ?int $notif = null
    // ) :self {
    //     throw new \Exception('TODO');
    // }
}
