<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:ClaudeDo.Ui.ViewModels.Modals"
        x:Class="ClaudeDo.Ui.Views.Modals.ListSettingsModalView"
        x:DataType="vm:ListSettingsModalViewModel"
        Title="List settings"
        Width="520" Height="600"
        WindowStartupLocation="CenterOwner"
        CanResize="False">
    <DockPanel Margin="16">
        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="8" Margin="0,16,0,0">
            <Button Content="Cancel" Command="{Binding CancelCommand}" />
            <Button Content="Save" Command="{Binding SaveCommand}" Classes="accent" />
        </StackPanel>

        <ScrollViewer>
            <StackPanel Spacing="16">
                <TextBlock Text="General" FontSize="16" FontWeight="SemiBold" />

                <StackPanel Spacing="4">
                    <TextBlock Text="Name" />
                    <TextBox Text="{Binding Name}" />
                </StackPanel>

                <StackPanel Spacing="4">
                    <TextBlock Text="Working directory" />
                    <Grid ColumnDefinitions="*,Auto">
                        <TextBox Grid.Column="0" Text="{Binding WorkingDir}" PlaceholderText="(none)" />
                        <Button Grid.Column="1" Content="Browse..." Margin="8,0,0,0" Click="BrowseClicked" />
                    </Grid>
                </StackPanel>

                <StackPanel Spacing="4">
                    <TextBlock Text="Default commit type" />
                    <ComboBox ItemsSource="{Binding CommitTypeOptions}"
                              SelectedItem="{Binding DefaultCommitType, Mode=TwoWay}"
                              HorizontalAlignment="Left" MinWidth="160" />
                </StackPanel>

                <Separator Margin="0,8,0,8" />

                <Grid ColumnDefinitions="*,Auto">
                    <TextBlock Grid.Column="0" Text="Agent" FontSize="16" FontWeight="SemiBold" />
                    <Button Grid.Column="1" Content="Reset agent settings"
                            Command="{Binding ResetAgentSettingsCommand}" />
                </Grid>

                <StackPanel Spacing="4">
                    <TextBlock Text="Model" />
                    <ComboBox ItemsSource="{Binding ModelOptions}"
                              SelectedItem="{Binding SelectedModel, Mode=TwoWay}"
                              HorizontalAlignment="Left" MinWidth="160" />
                </StackPanel>

                <StackPanel Spacing="4">
                    <TextBlock Text="System prompt (appended)" />
                    <TextBox Text="{Binding SystemPrompt, Mode=TwoWay}"
                             AcceptsReturn="True" TextWrapping="Wrap"
                             MinHeight="80" />
                </StackPanel>

                <StackPanel Spacing="4">
                    <TextBlock Text="Agent file" />
                    <ComboBox ItemsSource="{Binding Agents}"
                              SelectedItem="{Binding SelectedAgent, Mode=TwoWay}"
                              HorizontalAlignment="Left" MinWidth="240">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel>
                                    <TextBlock Text="{Binding Name}" />
                                    <TextBlock Text="{Binding Description}" Opacity="0.6" FontSize="11" />
                                </StackPanel>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>
                </StackPanel>
            </StackPanel>
        </ScrollViewer>
    </DockPanel>
</Window>
