using System.Threading.Tasks;
using Marechai.Database.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

namespace Marechai.Areas.Identity.Pages.Account.Manage;

public class PersonalDataModel(UserManager<ApplicationUser> userManager, ILogger<PersonalDataModel> logger) : PageModel
{
    readonly ILogger<PersonalDataModel>   _logger      = logger;

    public async Task<IActionResult> OnGet()
    {
        ApplicationUser user = await userManager.GetUserAsync(User);

        if(user == null) return NotFound($"Unable to load user with ID '{userManager.GetUserId(User)}'.");

        return Page();
    }
}