<?xml version="1.0" encoding="utf-8" ?>
<controls:AppContentDialog
    x:Class="RodelAgent.UI.Controls.Chat.ChatPresetSettingsDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:RodelAgent.UI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:RodelAgent.UI.Extensions"
    xmlns:ic="using:FluentIcons.WinUI"
    xmlns:local="using:RodelAgent.UI.Controls.Chat"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Padding="0"
    Style="{StaticResource DefaultContentDialogStyle}"
    mc:Ignorable="d">

    <controls:AppContentDialog.Resources>
        <x:Double x:Key="ContentDialogMinWidth">320</x:Double>
        <x:Double x:Key="ContentDialogMaxWidth">800</x:Double>
        <x:Double x:Key="ContentDialogMinHeight">184</x:Double>
        <x:Double x:Key="ContentDialogMaxHeight">1999</x:Double>
        <Thickness x:Key="ContentDialogPadding">0</Thickness>
    </controls:AppContentDialog.Resources>

    <Grid MinWidth="700" MinHeight="500">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Padding="20" Background="{ThemeResource LayerFillColorDefaultBrush}">
            <local:PresetModelPanel
                x:Name="ModelPanel"
                ViewModel="{x:Bind ViewModel, Mode=OneWay}"
                Visibility="{x:Bind ViewModel.IsModelSelectionStep, Mode=OneWay}" />
            <local:PresetDetailPanel ViewModel="{x:Bind ViewModel, Mode=OneWay}" Visibility="{x:Bind ViewModel.IsPresetDetailStep, Mode=OneWay}" />
        </Grid>

        <Button
            x:Name="CloseButton"
            HorizontalAlignment="Right"
            VerticalAlignment="Top"
            AutomationProperties.Name="{ext:Locale Name=Close}"
            Click="OnCloseButtonClick"
            CornerRadius="0,4,0,0"
            Style="{StaticResource IconButtonStyle}"
            ToolTipService.ToolTip="{ext:Locale Name=Close}">
            <Button.KeyboardAccelerators>
                <KeyboardAccelerator Key="Escape" IsEnabled="True" />
            </Button.KeyboardAccelerators>
            <ic:SymbolIcon FontSize="14" Symbol="Dismiss" />
        </Button>

        <Grid
            Grid.Row="1"
            Padding="20,16"
            BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
            BorderThickness="0,1,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <StackPanel
                Grid.Column="1"
                VerticalAlignment="Center"
                Orientation="Horizontal">
                <HyperlinkButton
                    MinWidth="120"
                    Margin="0,0,12,0"
                    AutomationProperties.Name="{ext:Locale Name=PrevStep}"
                    Command="{x:Bind ViewModel.GoPrevCommand, Mode=OneWay}"
                    Content="{ext:Locale Name=PrevStep}"
                    Visibility="{x:Bind ViewModel.IsPreviousStepShown, Mode=OneWay}" />
                <Button
                    MinWidth="120"
                    AutomationProperties.Name="{ext:Locale Name=NextStep}"
                    Command="{x:Bind ViewModel.GoNextCommand, Mode=OneWay}"
                    Content="{ext:Locale Name=NextStep}"
                    IsEnabled="{x:Bind ViewModel.IsNextButtonEnabled, Mode=OneWay}"
                    Style="{StaticResource AccentButtonStyle}"
                    Visibility="{x:Bind ViewModel.IsLastStep, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}" />
                <Button
                    MinWidth="120"
                    VerticalAlignment="Center"
                    AutomationProperties.Name="{ext:Locale Name=Finish}"
                    Click="OnSaveClickAsync"
                    Content="{ext:Locale Name=Finish}"
                    Style="{StaticResource AccentButtonStyle}"
                    Visibility="{x:Bind ViewModel.IsLastStep, Mode=OneWay}" />
            </StackPanel>
        </Grid>
    </Grid>
</controls:AppContentDialog>
