<Window x:Class="OpenGptChat.Views.Dialogs.ChatSessionConfigDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:s="clr-namespace:System;assembly=mscorlib"
        xmlns:local="clr-namespace:OpenGptChat.Views.Dialogs"
        xmlns:converters="clr-namespace:OpenGptChat.Converters"
        xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
        xmlns:mybehaviors="clr-namespace:OpenGptChat.Behaviors"
        mc:Ignorable="d" WindowStartupLocation="CenterOwner" ResizeMode="NoResize"
        d:DataContext="{d:DesignInstance Type=local:ChatSessionConfigDialog}"
        Title="ChatSessionConfigDialog" Height="550" Width="400" Background="{DynamicResource GeneralBackground}">
    <behaviors:Interaction.Behaviors>
        <mybehaviors:WindowStyleManagerBehavior/>
    </behaviors:Interaction.Behaviors>
    
    <Grid>
        <Grid>
            <ScrollViewer VerticalScrollBarVisibility="Auto">
                <StackPanel Margin="10">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock VerticalAlignment="Center">
                            <Run Text="{DynamicResource StrEnableChatContext}"/>
                            <Run Text=":"/>
                        </TextBlock>

                        <ComboBox Name="enableChatContextComboBox"
                                  Grid.Column="1" VerticalAlignment="Center"
                                  SelectionChanged="ComboBox_SelectionChanged">
                            <ComboBoxItem Content="{DynamicResource StrAuto}" Tag="{x:Null}"/>
                            
                            <ComboBoxItem Content="{DynamicResource StrYes}" >
                                <ComboBoxItem.Tag>
                                    <s:Boolean>True</s:Boolean>
                                </ComboBoxItem.Tag>
                            </ComboBoxItem>

                            <ComboBoxItem Content="{DynamicResource StrNo}">
                                <ComboBoxItem.Tag>
                                    <s:Boolean>False</s:Boolean>
                                </ComboBoxItem.Tag>
                            </ComboBoxItem>
                        </ComboBox>
                    </Grid>
                    <StackPanel Margin="0 5">
                        <Grid>
                            <TextBlock Margin="0 0 0 5">
                                <Run Text="{DynamicResource StrSystemMessages}"/>
                                <Run Text=":"/>
                            </TextBlock>

                            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                                <Button Content=" - " BorderThickness="0" Padding="3 0"
                                    Command="{Binding RemoveSystemMessageCommand}" ToolTip="Remove a system message"/>
                                <Button Content=" + " BorderThickness="0" Margin="5 0 0 0" Padding="3 0"
                                    Command="{Binding AddSystemMessageCommand}" ToolTip="Add a system message"/>
                            </StackPanel>
                        </Grid>
                        <Border MinHeight="10"
                            BorderThickness="1" BorderBrush="{DynamicResource BoxBorder}" Padding="5">
                            <ItemsControl ItemsSource="{Binding Session.SystemMessages}">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <TextBox Padding="5 3" Margin="0 1"  Text="{Binding Value}" TextWrapping="Wrap" AcceptsReturn="True"/>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </Border>
                    </StackPanel>
                </StackPanel>
            </ScrollViewer>

            <Button Content="{DynamicResource StrOk}" Command="{Binding AcceptCommand}"
                    Margin="20 10" Padding="10 5" MinWidth="50"
                    VerticalAlignment="Bottom" HorizontalAlignment="Right">
                <Button.Resources>
                    <Style TargetType="Border">
                        <Setter Property="CornerRadius" Value="3"/>
                    </Style>
                </Button.Resources>
            </Button>
        </Grid>
    </Grid>
</Window>
