<CascadingAuthenticationState>
    <Router AppAssembly="typeof(Routes).Assembly"
            AdditionalAssemblies="new[] { typeof(ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout).Assembly }">
        <Found Context="routeData">
            <AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout)">
                <NotAuthorized>
                    @if (context.User.Identity?.IsAuthenticated != true)
                    {
                        <RedirectToLogin />
                    }
                    else
                    {
                        <NotAuthorizedView />
                    }
                </NotAuthorized>
                <Authorizing>
                    <p class="text-muted p-3">Checking authorization...</p>
                </Authorizing>
            </AuthorizeRouteView>
        </Found>
        <NotFound>
            <LayoutView Layout="typeof(ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout)">
                <div class="container mt-5">
                    <h3>Page Not Found</h3>
                    <p class="text-muted">The requested page does not exist.</p>
                    <a href="/" class="btn btn-outline-primary btn-sm">Return to Dashboard</a>
                </div>
            </LayoutView>
        </NotFound>
    </Router>
</CascadingAuthenticationState>
