@using System.Security.Claims
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager

@if (Context.User?.Identity?.IsAuthenticated ?? false)
{
    string userName = User.GetUserName();

        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="dropdown04" data-bs-toggle="dropdown" aria-expanded="false">Plateforme</a>
            <ul class="dropdown-menu" aria-labelledby="dropdown04">
                <li><a class="dropdown-item" asp-controller="Bug" asp-action="Index">Bugs</a></li>
                <li><a class="dropdown-item" asp-controller="HyperLink" asp-action="Index">HyperLink</a></li>
                <li><a class="dropdown-item" asp-controller="Feature" asp-action="Index">Features</a></li>
            </ul>
        </li>
        @if (User.IsInMsRole(Constants.AdminGroupName)) {
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="dropdown05" data-bs-toggle="dropdown" aria-expanded="false">
                Administration
            </a>
            <ul class="dropdown-menu" aria-labelledby="dropdown05">
                <li><a class="dropdown-item" asp-controller="Administration" asp-action="Index">Index</a></li>
                <li><a class="dropdown-item" asp-controller="Announces" asp-action="Index">Announces</a></li>
                <li><a class="dropdown-item" asp-controller="Activity" asp-action="Index">Activités</a></li>
                <li><a class="dropdown-item" asp-controller="CommandForms" asp-action="Index">Formulaires</a></li>
                <li><a class="dropdown-item" asp-controller="Notifications" asp-action="Index">Notifications</a></li>
                <li><a class="dropdown-item" asp-controller="SIRENExceptions" asp-action="Index">Excéptions au numéro de SIREN</a></li>
                <li><a class="dropdown-item" asp-controller="Client" asp-action="Index">Accès API</a></li>
                <li><a class="dropdown-item" asp-controller="MailingTemplate" asp-action="Index">Emailing</a></li>
            </ul>
        </li>}
    <li class="nav-item dropdown">
         <a class="nav-link dropdown-toggle" href="#" id="dropdown04" data-bs-toggle="dropdown" aria-expanded="false">Hello @userName!</a>
        <ul class="dropdown-menu">
            <li>
        <a class="dropdown-item" asp-controller="Manage" asp-action="Index" title="Manage">
            <img src="/avatars/@(User.GetUserName()).xs.png" asp-append-version="true" class="smalltofhol" />
            Manage your account
        </a>
            </li>
            <li><a class="dropdown-item" asp-controller="Grants" asp-action="Index">Grants</a></li>
            <li><a class="dropdown-item" asp-controller="Device" asp-action="Index">Device</a></li>
            <li><a class="dropdown-item" asp-controller="Diagnostics" asp-action="Index">Diagnostics</a></li>
            <li><a class="dropdown-item" asp-controller="Account" asp-action="Logout">Logout</a></li>
        </ul>
    </li>
}
else
{
    <li class="dropdown-item">
        <a class="nav-link" asp-controller="Account" asp-action="Register" >Register</a>
    </li>
    <li class="dropdown-item">
        <a class="nav-link" asp-controller="Account" asp-action="Login" asp-route-ReturnUrl="~/" >Login</a>
    </li>
}

