<window:StyleableAppWindow
    x:Class="Ryujinx.Ava.UI.Windows.GameSpecificSettingsWindow"
    xmlns="https://github.com/avaloniaui"
    xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:window="clr-namespace:Ryujinx.Ava.UI.Windows"
    xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
    xmlns:settings="clr-namespace:Ryujinx.Ava.UI.Views.Settings"
    xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
    xmlns:helper="clr-namespace:Ryujinx.Common.Helper;assembly=Ryujinx.Common"
    Width="1100"
    Height="910"
    MinWidth="1037"
    MinHeight="480"
    WindowStartupLocation="CenterOwner"
    x:DataType="viewModels:SettingsViewModel"
    mc:Ignorable="d"
    Focusable="True">
    <Design.DataContext>
        <viewModels:SettingsViewModel />
    </Design.DataContext>
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinWidth="600" RowDefinitions="Auto,*,Auto">
        <ContentPresenter
            x:Name="ContentPresenter"
            Grid.Row="1"
            IsVisible="False"
            KeyboardNavigation.IsTabStop="False"/>
        <Grid Name="Pages" IsVisible="False" Grid.Row="2">
            <settings:SettingsUiView Name="UiPage" />
            <settings:SettingsInputView Name="InputPage" />
            <settings:SettingsSystemView Name="SystemPage" />
            <settings:SettingsCPUView Name="CpuPage" />
            <settings:SettingsGraphicsView Name="GraphicsPage" />
            <settings:SettingsAudioView Name="AudioPage" />
            <settings:SettingsNetworkView Name="NetworkPage" />
            <settings:SettingsLoggingView Name="LoggingPage" />
            <settings:SettingsHacksView Name="HacksPage" />
        </Grid>
        <ui:NavigationView
            Grid.Row="1"
            IsSettingsVisible="False"
            Name="NavPanel"
            IsBackEnabled="False"
            PaneDisplayMode="Left"
            Margin="2,10,10,0"
            VerticalAlignment="Stretch"
            HorizontalAlignment="Stretch"
            OpenPaneLength="200"
            IsPaneToggleButtonVisible="False">

            <!-- For image -->
            <ui:NavigationView.PaneHeader>
                <Grid HorizontalAlignment="Center" VerticalAlignment="Center" RowDefinitions="Auto,Auto,Auto,5">
                    <TextBlock Text="{Binding GameId}"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Margin="0,0,0,10"
                               TextAlignment="Center" Grid.Row="0" />
                    <Image Source="{Binding GameIcon}" 
                        Width="160" 
                        Height="160" 
                        Grid.Row="1" 
                        Margin="0,0,0,10"
                        HorizontalAlignment="Center" />
                    <TextBlock Text="{Binding GameTitle}"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Margin="0,0,0,10"
                        TextAlignment="Center" Grid.Row="2" />
                    <Separator Height="1" Grid.Row="3" Margin="0,0,0,10" HorizontalAlignment="Stretch"/>
                </Grid>
            </ui:NavigationView.PaneHeader>
                      
            <ui:NavigationView.MenuItems>
                <ui:NavigationViewItem
                    IsSelected="True"
                    Content="{ext:Locale SettingsTabGeneral}"
                    Tag="UiPage"
                    IconSource="New" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabInput}"
                    Tag="InputPage"
                    IconSource="Games" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabSystem}"
                    Tag="SystemPage"
                    IconSource="Settings" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabCpu}"
                    Tag="CpuPage">
                    <ui:NavigationViewItem.IconSource>
                        <ui:FontIconSource
                            FontFamily="avares://Ryujinx/Assets/Fonts#Segoe Fluent Icons"
                            Glyph="{helpers:GlyphValueConverter Chip}" />
                    </ui:NavigationViewItem.IconSource>
                </ui:NavigationViewItem>
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabGraphics}"
                    Tag="GraphicsPage"
                    IconSource="Image" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabAudio}"
                    IconSource="Audio"
                    Tag="AudioPage" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabNetwork}"
                    Tag="NetworkPage"
                    IconSource="Globe" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabLogging}"
                    Tag="LoggingPage"
                    IconSource="Document" />
                <ui:NavigationViewItem
                    IsVisible="{Binding ShowDirtyHacks}"
                    Content="Dirty Hacks"
                    Tag="HacksPage"
                    IconSource="Code" />
            </ui:NavigationView.MenuItems>
        </ui:NavigationView>
        <Grid Grid.Row="3"
           ColumnDefinitions="Auto,*,Auto">
                <StackPanel Grid.Column="0" Orientation="Horizontal" Margin="10" Spacing="10">
                    <Button
                        IsVisible="{Binding !IsGameRunning}"
                        Content="{ext:Locale UserProfilesDelete}"
                        Command="{Binding DeleteConfigGame}"
                        Classes="red"/>
                </StackPanel>
            <ReversibleStackPanel
                Grid.Column="2"
                Margin="10"
                Spacing="10"
                Orientation="Horizontal"
                HorizontalAlignment="Right"
                ReverseOrder="{x:Static helper:RunningPlatform.IsMacOS}">
                <Button
                    Classes="accent"
                    Content="{ext:Locale SettingsButtonSave}"
                    Command="{Binding SaveUserConfig}" />
                <Button
                    HotKey="Escape"
                    Content="{ext:Locale SettingsButtonClose}"
                    Command="{Binding CancelButton}" />
                <Button
                    Content="{ext:Locale SettingsButtonApply}"
                    Command="{Binding ApplyButton}" />
            </ReversibleStackPanel>
        </Grid>
    </Grid>
</window:StyleableAppWindow>
