using AutoCat.Pages;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

using muxc = Microsoft.UI.Xaml.Controls;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace AutoCat
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        private readonly List<(string Tag, Type Page)> _pages = new List<(string Tag, Type Page)>
        {
            ("CheckPlateNumber", typeof(CheckPage)),
            ("SearchPlateNumber", typeof(SearchPage)),
        };

        public MainPage()
        {
            this.InitializeComponent();
            NavView.PaneDisplayMode = muxc.NavigationViewPaneDisplayMode.LeftCompact;
        }

		private void NavView_SelectionChanged(muxc.NavigationView sender, muxc.NavigationViewSelectionChangedEventArgs args)
		{
            string tag = args.SelectedItemContainer.Tag.ToString();
            var page = _pages.FirstOrDefault(p => p.Tag.Equals(tag)).Page;
            ContentFrame.Navigate(page, null, args.RecommendedNavigationTransitionInfo);
		}

		private void NavView_Loaded(object sender, RoutedEventArgs e)
		{
            NavView.SelectedItem = NavView.MenuItems[0];
        }
	}
}
