@inject AuthenticationStateProvider AuthenticationStateProvider
@using Microsoft.AspNetCore.Components.Authorization;
@using ReAct_PME.WebUI.ServicesUI;

<div>

    <nav class="menu-section access-section">

        <div class="nav-item">
            <NavLink class="nav-link2" href="" Match="NavLinkMatch.All">
                <span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
            </NavLink>
        </div>


        <div class="nav-item">
            <details>
                <summary>💬 ChatRoom</summary>
                <div class="nav-item">
                    <NavLink class="nav-link2" href="chatroom_nav/1">Chat</NavLink>
                    <NavLink class="nav-link2" href="chatroom_nav/2">RAG</NavLink>
                </div>
            </details>
        </div>

        <div class="nav-item">
            <details>
                <summary>📧 Emails</summary>
                <div class="nav-item">
                    <NavLink class="nav-link2" href="listemails_card">Non lus</NavLink>
                    <NavLink class="nav-link2" href="listemailssend_card">A suivre</NavLink>
                    <NavLink class="nav-link2" href="editmail_redaction">Rédaction d'un mail</NavLink>
                </div>
            </details>
        </div>

        <div class="nav-item">
            <details>
                <summary>⚙️ Paramètres</summary>
                <div class="nav-item">
                    <NavLink class="nav-link2" href="parametres_mail">Mails</NavLink>
                </div>
            </details>
        </div>

    </nav>
</div>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>

@code {
    private bool collapseNavMenu = false;

    private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;

    private void ToggleNavMenu()
    {
        collapseNavMenu = !collapseNavMenu;
    }

    private AuthenticationState? authState;
    private System.Security.Claims.ClaimsPrincipal? user;

    protected override async Task OnInitializedAsync()
    {
        authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
        user = authState.User;
    }
}
