using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PhilExample.Interfaces;
using PhilExample.Models;
using PhilExample.VMs;
using PhilExampleCrawler.Common.Models;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace PhilExample.UI.Pages
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class AddCrawlSessionPage : CallbackPage<CrawlSessionResponse>
    {
        private readonly AddCrawlSessionVM _vm = new AddCrawlSessionVM();

        public AddCrawlSessionPage()
        {
            InitializeComponent();

            BindingContext = _vm;

            _vm.OnPopped +=
                (_, csp) => SetPopupResult(csp);
        }

        protected override async void OnAppearing()
        {
            base.OnAppearing();
            await _vm.OnAppearingAsync();
        }
    }
}