@using Microsoft.AspNetCore.Components.Authorization

<nav class="navbar navbar-expand-lg bg-white border-bottom sticky-top">
    <div class="container-fluid">
        <NavLink class="navbar-brand fw-semibold" href="" Match="NavLinkMatch.All">
            Guestlist
        </NavLink>

        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNavigation"
                aria-controls="mainNavigation" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="mainNavigation">
            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                <li class="nav-item">
                    <NavLink class="nav-link" href="" Match="NavLinkMatch.All">Home</NavLink>
                </li>
                <li class="nav-item">
                    <NavLink class="nav-link" href="list">Guest list</NavLink>
                </li>

                <AuthorizeView Roles="Admin,Maintainer">
                    <Authorized>
                        <li class="nav-item">
                            <NavLink class="nav-link" href="guests">Manage guests</NavLink>
                        </li>
                    </Authorized>
                </AuthorizeView>

                <AuthorizeView Roles="Admin">
                    <Authorized>
                        <li class="nav-item">
                            <NavLink class="nav-link" href="admin">Admin</NavLink>
                        </li>
                        <li class="nav-item">
                            <NavLink class="nav-link" href="setup">Setup</NavLink>
                        </li>
                    </Authorized>
                </AuthorizeView>

                <AuthorizeView>
                    <NotAuthorized>
                        <li class="nav-item">
                            <NavLink class="nav-link" href="login">Login</NavLink>
                        </li>
                    </NotAuthorized>
                </AuthorizeView>
            </ul>

            <AuthorizeView>
                <Authorized>
                    <form method="post" action="/auth/logout" class="d-flex">
                        <button type="submit" class="btn btn-outline-secondary btn-sm">
                            Logout
                        </button>
                    </form>
                </Authorized>
            </AuthorizeView>
        </div>
    </div>
</nav>
