<Window 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:vm="using:ClawdDotNet.Desktop.ViewModels"
        mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="400"
        Width="640" Height="420"
        Padding="16"
        WindowStartupLocation="CenterOwner"
        CanResize="False"
        Title="Sicherung wiederherstellen"
        x:Class="ClawdDotNet.Desktop.Views.RestoreBackupWindow"
        x:DataType="vm:RestoreBackupViewModel">

  <DockPanel>

    <!-- Buttons unten -->
    <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="8" Margin="0,16,0,0">
      <Button Content="Abbrechen" Command="{Binding CancelCommand}" />
      <Button Content="Wiederherstellen" Command="{Binding ConfirmCommand}" Classes="accent" />
    </StackPanel>

    <!-- Statusmeldung unten -->
    <TextBlock DockPanel.Dock="Bottom" Text="{Binding StatusMessage}" Foreground="Red" Margin="0,8,0,0" TextWrapping="Wrap" />

    <ScrollViewer>
      <StackPanel Spacing="12">

        <!-- Information -->
        <Border Classes="card">
          <StackPanel Spacing="4">
            <TextBlock Text="Sicherungsinformationen" Classes="heading" />
            <TextBlock Text="{Binding InstanceName, StringFormat='Instanz: {0}'}" />
            <TextBlock Text="{Binding CreatedAt, StringFormat='Erstellt: {0:g}'}" />
            <TextBlock Text="{Binding FileCount, StringFormat='Dateien: {0}'}" />
            <TextBlock Text="{Binding SecretsDescription, StringFormat='Zugangsdaten: {0}'}" />
          </StackPanel>
        </Border>

        <!-- Zielordner -->
        <StackPanel Spacing="4">
          <TextBlock Text="Zielordner:" FontWeight="Bold" />
          <Grid ColumnDefinitions="*,Auto">
            <TextBox Text="{Binding TargetDirectory}" Grid.Column="0" />
            <Button Content="Ordner wählen" Click="OnBrowseFolder" Grid.Column="1" Margin="8,0,0,0" />
          </Grid>
          <TextBlock Text="Hinweis: Es wird empfohlen, in einen neuen Ordner wiederherzustellen, um Konflikte mit laufenden Prozessen zu vermeiden."
                     Classes="caption" TextWrapping="Wrap" />
        </StackPanel>

        <!-- Passphrase -->
        <StackPanel Spacing="4" IsVisible="{Binding NeedsPassphrase}">
          <TextBlock Text="Passphrase:" FontWeight="Bold" />
          <TextBox Text="{Binding Passphrase}" PasswordChar="*" />
          <TextBlock Text="Diese Sicherung enthält geschützte Zugangsdaten." Classes="caption" />
        </StackPanel>

        <!-- Überschreiben -->
        <CheckBox Content="Vorhandene Dateien im Zielordner überschreiben" IsChecked="{Binding Overwrite}" Margin="0,8,0,0" />

      </StackPanel>
    </ScrollViewer>

  </DockPanel>

</Window>
