<?php

namespace ServerManager\UI;

use PHPNative\Framework\Application;
use PHPNative\Ui\Widget\Menu;
use PHPNative\Ui\Widget\MenuBar;

class MenuBarBuilder
{
    public static function buildMenus(Application $app, MenuBar $menuBar, SettingsModal $settingsModal): void
    {
        // File Menu
        $fileMenu = new Menu(title: 'Datei');
        $fileMenu->addItem('Beenden', function () use ($app) {
            exit(0);
        });

        // Settings Menu
        $settingsMenu = new Menu(title: 'Einstellungen');
        $settingsMenu->addItem('Optionen', function () use ($settingsModal) {
            $settingsModal->show();
        });

        $menuBar->addMenu($fileMenu);
        $menuBar->addMenu($settingsMenu);
    }
}
