using ViewModel;

namespace App.Pages;

public partial class ChampionsListPage : ContentPage
{
    public ChampionManagerVM ChampionManagerVM { get; private set; }

	public ChampionsListPage(ChampionManagerVM championManagerVM)
	{
		ChampionManagerVM = championManagerVM;
		InitializeComponent();
		BindingContext = ChampionManagerVM;
    }

    async void AddClicked(System.Object sender, System.EventArgs e)
    {
		await Shell.Current.GoToAsync(nameof(ChampionAddEditPage));
    }

    async void ListView_ItemSelected(System.Object sender, Microsoft.Maui.Controls.SelectedItemChangedEventArgs e)
    {
        await Shell.Current.GoToAsync(nameof(ChampionDetailPage), true, new Dictionary<string, object>
        {
            { "ChampionVM", e.SelectedItem }
        });
    }
}
