using Front.Program.ViewModels;
using Front.Program.Services;
using Microsoft.AspNetCore.Components;
using System.Net.Http.Json;
using System.Runtime.InteropServices.JavaScript;
using System.Text.Json;
using Front.Program.Models;

namespace Front.Program.Views.Academy.Common;

public partial class TopNavAcademy : ComponentBase
{
    [Inject] UserStateService UserStateService { get; set; } = default!;
    
    protected bool isOpen = false;
    protected bool isAcademyDropdownOpen = false;
    protected Models.SimpleAcademy[] academyItems = Array.Empty<Models.SimpleAcademy>();

    protected override async Task OnInitializedAsync()
    {
        LoggerService.Write("TOPNAV_OnInitializedAsync");
    }

    protected void ToggleAcademyDropdown() {
        isAcademyDropdownOpen = !isAcademyDropdownOpen;
    }

    private void OnClickOutside()
    {
        if (isAcademyDropdownOpen) isAcademyDropdownOpen = false;
        StateHasChanged();
    }
}