@using Zap.BI.Core.Security.Diagnostics
@using Zap.BI.Portal.Models.Diagnostics
@using Zap.BI.Portal.Pages.Diagnostics
@using Zap.Collections
@model AdUserDiagnostic

@{
    Layout = null;
}

@if (Model.User == null)
{
    <h2 class="badMessage">@DiagnosticText.ADDiagnostics_CouldNotFindUser</h2>
}
else
{
    <h2 class="user-found">@Model.User.FullName</h2>
    
    if (Model.UserPrincipal != null)
    {
        Html.RenderPartial("ExecutionInfo", Model.UserPrincipal);
        Html.RenderPartial("Principals", new PrincipalListModel(Model.UserPrincipal.Result.ToEnumerable()));

        <h3>@DiagnosticText.ADDiagnostics_User_AuthorizationGroups</h3>
        Html.RenderPartial("ExecutionInfo", Model.AuthorizationGroups);
        Html.RenderPartial("Principals", new PrincipalListModel(Model.AuthorizationGroups.Result));

        <h3>@DiagnosticText.ADDiagnostics_User_TokenGroups</h3>
        Html.RenderPartial("ExecutionInfo", Model.TokenGroups);
        Html.RenderPartial("Principals", new PrincipalListModel(Model.TokenGroups.Result));
        
        <h3>@DiagnosticText.ADDiagnostics_User_TokenGroupsGlobal</h3>
        Html.RenderPartial("ExecutionInfo", Model.TokenGroupsGlobal);
        Html.RenderPartial("Principals", new PrincipalListModel(Model.TokenGroupsGlobal.Result));
        
        <h3>@DiagnosticText.ADDiagnostics_User_TokenGroupsGlobalAndUniversal</h3>
        Html.RenderPartial("ExecutionInfo", Model.TokenGroupsGlobalAndUniversal);
        Html.RenderPartial("Principals", new PrincipalListModel(Model.TokenGroupsGlobalAndUniversal.Result));
    }
}