using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Server.Auth;
using Microsoft.AspNetCore.Components;

namespace FoodsharingSiegen.Server.Shared
{
    /// <summary>
    ///     The nav menu class (a. beging, 07.02.2023)
    /// </summary>
    public partial class NavMenu
    {
        #region Dependencies

        /// <summary>
        ///     Gets or sets the value of the auth service (ab)
        /// </summary>
        [Inject] protected AuthService AuthService { get; set; } = null!;

        #endregion

        #region Private Properties

        /// <summary>
        ///     Gets the value of the current user (ab)
        /// </summary>
        private User CurrentUser => AuthService.User ?? new User();

        #endregion

        #region Override OnInitializedAsync

        /// <summary>
        ///     Ons the initialized (a. beging, 07.02.2023)
        /// </summary>
        protected override async Task OnInitializedAsync()
        {
            await AuthService.Initialize();
            await base.OnInitializedAsync();
        }

        #endregion
    }
}