using System.Threading.Tasks;
using Blazored.Modal;
using Blazored.Modal.Services;
using DiplomovaPrace.Contracts.Security.InputModels;
using Microsoft.AspNetCore.Components;

namespace DiplomovaPrace.Web.Admin.Shared.Common
{
	public partial class PasswordChangeModal
	{
		[CascadingParameter]
		public BlazoredModalInstance ModalInstance { get; set; }

		[Parameter]
		public string ConfirmButtonText { get; set; }

		[Parameter]
		public string CancelButtonText { get; set; }

		private PasswordChangeIM PasswordChange { get; set; } = new();

		protected override async Task OnInitializedAsync()
		{
			await base.OnInitializedAsync().ConfigureAwait(false);
		}

		private void SubmitForm()
		{
			ModalInstance.CloseAsync(ModalResult.Ok(PasswordChange));
		}

		private void Cancel()
		{
			ModalInstance.CancelAsync();
		}
	}
}
