@using TIAMWebApp.Shared.Application.Interfaces
@using AyCode.Interfaces.StorageHandlers
@using Microsoft.Extensions.Localization
@inject ISecureStorageHandler SecureStorageHandler
@inject IStringLocalizer<MyResources> localizer

<div class="top-row ps-3 navbar navbar-light">
    <div class="container-fluid">
        <button title="Back button" class="my-back-button" style="display:none" @onclick="NavigateBack">
            <img src="_content/TIAMSharedUI/images/navbar-toggler.png" width="40" />
        </button>
        <a class="navbar-brand my-navbar-brand" href=""></a>        
        <button title="Navigation menu" class="navbar-toggler my-navbar-toggler" @onclick="ToggleNavMenu">
            <img src="_content/TIAMSharedUI/images/navbar-toggler.png" width="40" />
        </button>
        
    </div>
    

</div>

<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
    <div style="display: flex; align-content: center; justify-content:center" class="my-navbar-hero">

        <a class="navbar-brand my-navbar-brand" href=""><img src="_content/TIAMSharedUI/images/logo_wide.png" alt="TourIam Logo" title="TourIAm Logo" /></a>

    </div>
    <nav class="flex-column">
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
                <!--span class="oi oi-home" aria-hidden="true"></span--> Home
            </NavLink>
        </div>
        <!--div class="nav-item px-3">
            <NavLink class="nav-link" href="counter">
                Counter
            </NavLink>
        </div-->                

        <div class="nav-item px-3">
            <NavLink class="nav-link" href="transfer">
                Transfer
            </NavLink>
        </div>
        
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="swagger">
                API
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="login">
                 Login
            </NavLink>
        </div><div class="nav-item px-3">
            <NavLink class="nav-link" href="settings">
                 Settings
            </NavLink>
        </div>
        <hr />
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="#" @onclick="SignOut">
                Signout
            </NavLink>
        </div>
    </nav>
</div>

@code {
    private bool collapseNavMenu = true;
    
    private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;

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

    private void NavigateBack()
    {

    }

    private void SignOut()
    {
        SecureStorageHandler.ClearAllSecureStorageAsync();
    }
}
