<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="Sonex.Client.AppWindows.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Sonex.Client"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:helpers="using:Sonex.Client.Helpers"
    mc:Ignorable="d"
    xmlns:ic="using:FluentIcons.WinUI"
    Title="Sonex">
    <Window.SystemBackdrop>
        <MicaBackdrop />
    </Window.SystemBackdrop>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TitleBar
            x:Name="titleBar"
            BackRequested="TitleBar_BackRequested"
            IsBackButtonVisible="{x:Bind navFrame.CanGoBack, Mode=OneWay}"
            IsPaneToggleButtonVisible="True"
            PaneToggleRequested="TitleBar_PaneToggleRequested"
            Margin="0"
            Padding="0"
            VerticalAlignment="Top"
            HorizontalContentAlignment="Left"
            VerticalContentAlignment="Top"
            >
            

            <!--  This is a workaround for https://github.com/microsoft/microsoft-ui-xaml/issues/10374, once fixed we should just be using IconSource  -->
            <!-- <TitleBar.IconSource>
                    <ImageIconSource ImageSource="/Assets/Tiles/GalleryIcon.ico" />
                 </TitleBar.IconSource>-->
            <TitleBar.LeftHeader>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Spacing="8">

                </StackPanel>
            </TitleBar.LeftHeader>

            <TitleBar.Content>
                <AutoSuggestBox QueryIcon="Find" PlaceholderText="Search..." Width="300">
                </AutoSuggestBox>
            </TitleBar.Content>
            <TitleBar.RightHeader>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Spacing="8" HorizontalAlignment="Right">
                    <PersonPicture Width="30" Height="30" Initials="SJ" />
                    <Border VerticalAlignment="Center">
                        <TextBlock Text="Samuel Jendryke"/>
                    </Border>
                    
                </StackPanel>
            </TitleBar.RightHeader>
        </TitleBar>
        <NavigationView
            x:Name="navView"
            Grid.Row="1"
            IsBackButtonVisible="Collapsed"
            
            IsPaneToggleButtonVisible="False"
            IsSettingsVisible="False"
            SelectionChanged="navView_SelectionChanged">
            <NavigationView.MenuItems>
                <!-- Nested NavigationViewItem for Home with submenu -->
                <NavigationViewItem Content="Home" SelectsOnInvoked="False">
                    <NavigationViewItem.Icon>
                        <ic:SymbolIcon Symbol="BookOpen" IconVariant="Color" />
                    </NavigationViewItem.Icon>
                    <NavigationViewItem.MenuItems>
                        <NavigationViewItem Content="Title Sample" Tag="TitleSample">
                            <NavigationViewItem.Icon>
                                <ic:SymbolIcon Symbol="SlideTextTitle" IconVariant="Regular" />
                            </NavigationViewItem.Icon>
                        </NavigationViewItem>
                        <NavigationViewItem Content="Table Sample" Tag="TableSample">
                            <NavigationViewItem.Icon>
                                <ic:SymbolIcon Symbol="Table" IconVariant="Regular" />
                            </NavigationViewItem.Icon>
                        </NavigationViewItem>
                    </NavigationViewItem.MenuItems>
                </NavigationViewItem>
                <!-- END -->
                
                <NavigationViewItem
                    Content="Menu Item2"
                    Icon="Save"
                    Tag="BlankPage2" />
                <NavigationViewItem
                    Content="Menu Item3"
                    Icon="Refresh"
                    Tag="BlankPage3" />
                <NavigationViewItem
                    Content="Menu Item4"
                    Icon="Download"
                    Tag="BlankPage43" />
            </NavigationView.MenuItems>
            <Frame x:Name="navFrame" IsNavigationStackEnabled="False">
                <Frame.ContentTransitions>
                    <TransitionCollection>
                        <NavigationThemeTransition  />
                    </TransitionCollection>
                </Frame.ContentTransitions>
            </Frame>
        </NavigationView>
    </Grid>
</Window>
