<?php

declare(strict_types=1);

namespace Maestro\Core\Http\Controllers;

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Maestro\Core\Services\NavigationTreeBuilder;

class NavigationController extends Controller
{
    public function __construct(
        private readonly NavigationTreeBuilder $navigationTreeBuilder
    ) {}

    public function index(Request $request): JsonResponse
    {
        $user = $request->user();

        return response()->json($this->navigationTreeBuilder->buildForUser($user));
    }
}
