<?php

namespace Hubleto\App\Community\Desktop;

class SidebarManager extends \Hubleto\Erp\Core
{
  public const ITEM_LINK = 'link';
  public const ITEM_DIVIDER = 'divider';
  public const ITEM_HEADING_1 = 'heading_1';
  public const ITEM_HEADING_2 = 'heading_2';

  /** @var array<int, array<string, bool|string>> */
  public array $items = [];

  public function addItem(string $type, string $url, string $title, string $icon, bool $highlighted = false): void
  {
    $this->items[] = [
      'type' => $type,
      'url' => $url,
      'title' => $title,
      'icon' => $icon,
      'highlighted' => $highlighted,
    ];
  }

  public function addLink(string $url, string $title, string $icon, bool $highlighted = false): void
  {
    $this->addItem(self::ITEM_LINK, $url, $title, $icon, $highlighted);
  }

  public function addDivider(): void
  {
    $this->addItem(self::ITEM_DIVIDER, '', '', '');
  }

  public function addHeading1(string $title): void
  {
    $this->addItem(self::ITEM_HEADING_1, '', $title, '');
  }

  public function addHeading2(string $title): void
  {
    $this->addItem(self::ITEM_HEADING_2, '', $title, '');
  }

  public function getItems(): array
  {
    return $this->items;
  }

}
