<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
                    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:v="using:SourceGit.Views"
                    xmlns:vm="using:SourceGit.ViewModels"
                    mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="120"
                    x:Class="SourceGit.Views.AIAssistant"
                    x:DataType="vm:AIAssistant"
                    x:Name="ThisControl"
                    Icon="/App.ico"
                    Title="{DynamicResource Text.AIAssistant}"
                    Width="520" SizeToContent="Height"
                    CanResize="False"
                    WindowStartupLocation="CenterOwner">
  <Grid RowDefinitions="Auto,Auto,Auto">
    <!-- TitleBar -->
    <Grid Grid.Row="0" Height="28" IsVisible="{Binding !#ThisControl.UseSystemWindowFrame}">
      <Border Background="{DynamicResource Brush.TitleBar}"
              BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
              PointerPressed="BeginMoveWindow"/>

      <Path Width="14" Height="14"
            Margin="10,0,0,0"
            HorizontalAlignment="Left"
            Data="{StaticResource Icons.AIAssist}"
            IsVisible="{OnPlatform True, macOS=False}"/>

      <TextBlock Classes="bold"
                 Text="{DynamicResource Text.AIAssistant}"
                 HorizontalAlignment="Center" VerticalAlignment="Center"
                 IsHitTestVisible="False"/>

      <v:CaptionButtons HorizontalAlignment="Right"
                        IsCloseButtonOnly="True"
                        IsVisible="{OnPlatform True, macOS=False}"/>
    </Grid>

    <!-- AI response -->
    <v:AIResponseView Grid.Row="1"
                      Margin="8"
                      Height="320"
                      BorderThickness="1"
                      BorderBrush="{DynamicResource Brush.Border2}"
                      Background="{DynamicResource Brush.Contents}"
                      Content="{Binding Text}"/>

    <!-- Options -->
    <Border Grid.Row="2" Margin="0,0,0,8">
      <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
        <v:LoadingIcon Width="14" Height="14"
                       Margin="0,0,8,0"
                       IsVisible="{Binding IsGenerating}"/>
        <Button Classes="flat"
                Height="28"
                Margin="0,0,8,0"
                Padding="12,0"
                Content="{DynamicResource Text.AIAssistant.Use}"
                IsEnabled="{Binding !IsGenerating}"
                Click="OnApply"/>
        <Button Classes="flat"
                Height="28"
                Padding="12,0"
                Content="{DynamicResource Text.AIAssistant.Regen}"
                IsEnabled="{Binding !IsGenerating}"
                Command="{Binding Regen}"/>
      </StackPanel>
    </Border>
  </Grid>
</v:ChromelessWindow>
