using System;
using System.Windows.Input;
using App.Pages;
using ViewModel;

namespace App.ViewModel
{
	public class ChampionListPageVM
	{
		public INavigation Navigation { get; set; }

		public ChampionManagerVM ChampionManagerVM { get; private set; }

		public ICommand NavigateToChampionDetailCommand { get; private set; }
		public ICommand NaviagteToChampionAddEditPageCommand { get; private set; }

        public ChampionListPageVM(ChampionManagerVM championManager)
		{
			ChampionManagerVM = championManager;

            NavigateToChampionDetailCommand = new Command (
				execute: async () => await Shell.Current.GoToAsync(nameof(ChampionDetailPage)),
				canExecute: () => ChampionManagerVM is not null
			);

            NaviagteToChampionAddEditPageCommand = new Command(
				execute: async () => await Navigation.PushModalAsync(new ChampionAddEditPage()),
				canExecute: () => ChampionManagerVM is not null
            );
        }
	}
}

