<UserControl x:Class="NebulaAuth.View.Dialogs.MafileImportDialog"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:nebulaAuth="clr-namespace:NebulaAuth"
             mc:Ignorable="d"
             Height="Auto" Width="Auto" MaxWidth="520"
             Background="{DynamicResource WindowBackground}">
    <Grid MinHeight="240" MinWidth="440">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <nebulaAuth:DialogHeader Title="{Tr MafileImportDialog.Title}" />

        <Grid Grid.Row="1" Margin="14,14,14,16">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Border Margin="6,0,6,12" Padding="12,10"
                    CornerRadius="8"
                    BorderThickness="1">
                <Border.Background>
                    <SolidColorBrush Color="{DynamicResource BaseContentColor}" Opacity="0.07" />
                </Border.Background>
                <Border.BorderBrush>
                    <SolidColorBrush Color="{DynamicResource BaseContentColor}" Opacity="0.12" />
                </Border.BorderBrush>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <TextBlock Text="{Tr MafileImportDialog.TotalCount}" Opacity="0.82" />
                    <TextBlock Grid.Column="1" Text="{Binding TotalCount, Mode=OneWay}" FontWeight="SemiBold" />

                    <TextBlock Grid.Row="1" Text="{Tr MafileImportDialog.ConflictCount}" Opacity="0.82"
                               Visibility="{Binding HasConflicts, Converter={StaticResource BooleanToVisibilityConverter}}" />
                    <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding ConflictCount, Mode=OneWay}"
                               FontWeight="SemiBold"
                               Foreground="{DynamicResource WarningBrush}"
                               Visibility="{Binding HasConflicts, Converter={StaticResource BooleanToVisibilityConverter}}" />
                </Grid>
            </Border>

            <CheckBox Grid.Row="1"
                      Margin="10,4,10,8"
                      IsChecked="{Binding OverwriteConflicts}"
                      Visibility="{Binding HasConflicts, Converter={StaticResource BooleanToVisibilityConverter}}"
                      Content="{Tr MafileImportDialog.OverwriteConflicts}" />

            <Separator Grid.Row="2"
                       Margin="10,2,10,2" Opacity="0.35"
                       Visibility="{Binding HasConflicts, Converter={StaticResource BooleanToVisibilityConverter}}" />

            <CheckBox Grid.Row="3"
                      Margin="10,4,10,0"
                      IsChecked="{Binding AddToGroup}"
                      Content="{Tr MafileImportDialog.AddToGroup}" />

            <ComboBox x:Name="GroupBox"
                      Grid.Row="4"
                      Margin="42,0,10,0"
                      IsEditable="True"
                      ItemsSource="{Binding Groups}"

                      Text="{Binding Group, UpdateSourceTrigger=PropertyChanged}"
                      materialDesign:HintAssist.Hint="{Tr MafileImportDialog.GroupFieldHint}"
                      materialDesign:HintAssist.IsFloating="False"
                      Visibility="{Binding AddToGroup, Converter={StaticResource BooleanToVisibilityConverter}}"
                      Style="{StaticResource MaterialDesignFloatingHintComboBox}" />

            <Grid Grid.Row="5" Margin="10,16,10,5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Button Width="130"
                        HorizontalAlignment="Left"
                        Margin="2,0,4,0"
                        Style="{StaticResource MaterialDesignFlatDarkBgButton}"
                        Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
                        CommandParameter="{Binding}"
                        Content="{Tr Common.OK}"
                        IsDefault="True" />
                <Button Grid.Column="1"
                        HorizontalAlignment="Right"
                        Width="130"
                        Margin="0,0,2,0"
                        Style="{StaticResource MaterialDesignOutlinedButton}"
                        Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
                        CommandParameter="{x:Null}"
                        Content="{Tr Common.Cancel}"
                        IsCancel="True" />
            </Grid>
        </Grid>
    </Grid>
</UserControl>