using System;
using System.Threading.Tasks;
using DiplomovaPrace.Contracts.Security.InputModels;
using DiplomovaPrace.Web.Admin.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;

namespace DiplomovaPrace.Web.Admin.Pages.Security
{
	public partial class RegistrationForm
	{
		[Inject]
		private ISecurityService SecurityService { get; set; }

		private RegisterAccountIM registerAccount = new();
		// TODO fix editContext
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
		private EditContext? editContext;
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

		protected override async Task OnInitializedAsync()
		{
			await base.OnInitializedAsync().ConfigureAwait(false);
			editContext = new(registerAccount);
		}

		private void HandleSubmit()
		{
			throw new NotImplementedException();
			//await SecurityService.RegisterAccountAsync(registerAccount).ConfigureAwait(false);
		}
	}
}
