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

namespace DiplomovaPrace.Web.Admin.Pages.Orders.Modal
{
	public partial class AddressCreateUpdateModal
	{
		[CascadingParameter]
		public BlazoredModalInstance ModalInstance { get; set; }

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

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

		[Parameter]
		public AddressDto AddressIM { get; set; } = new();

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

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

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