<Panel 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"

        d:DesignWidth="600" d:DesignHeight="500"

        x:Class="MercuryConverter.UI.Views.Export"

        xmlns:views="clr-namespace:MercuryConverter.UI.Views"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:util="clr-namespace:MercuryConverter.Utility"
        xmlns:merc="clr-namespace:MercuryConverter"
>
    <DockPanel>
        <StackPanel Name="ExportSelectionPane" DockPanel.Dock="Top" Orientation="Horizontal" Margin="12 0 0 3">
            <RadioButton GroupName="ExportTarget" Content="Export selected" IsChecked="true" Margin="0 0 24 0"/>
            <RadioButton Name="RadioExportAll" GroupName="ExportTarget" Content="Export All"/>
        </StackPanel>

        <Grid RowDefinitions="*, Auto" DockPanel.Dock="Right" Width="200" Margin="12 0 0 0">
            <StackPanel Name="ExportOptionsPane" Grid.Row="0">
                <TextBlock Text="Chart Format" FontWeight="Medium" Margin="0 0 0 4"/>
                <ComboBox Name="ListSelectChartFormat" Margin="0 0 0 16" SelectedIndex="3">
                    <ComboBoxItem Content=".mer (WacK)"/>
                    <ComboBoxItem Content=".sat (V1)"/>
                    <ComboBoxItem Content=".sat (V2)"/>
                    <ComboBoxItem Content=".sat (V3)"/>
                </ComboBox>

                <TextBlock Text="Audio Format" FontWeight="Medium" Margin="0 0 0 4"/>
                <StackPanel Margin="10 0 0 42">
                    <RadioButton Name="RadioLeaveAudioWAV" GroupName="AudioFormat" IsChecked="true" Content="Leave as WAV"/>
                    <RadioButton Name="RadioShouldAudioConvert" GroupName="AudioFormat">
                        <ComboBox Name="ListSelectAudioConvertFormat" IsEnabled="false" PlaceholderText="Convert to...">
                            <ComboBoxItem Content="mp3"/>
                            <ComboBoxItem Content="ogg"/>
                        </ComboBox>
                    </RadioButton>
                    <TextBlock Name="NoFFMpegMessage" Text="Could not find FFmpeg. Make sure it is installed and on PATH!" TextWrapping="Wrap" Foreground="Red" FontWeight="DemiBold" Opacity="0.8" FontSize="12"/>
                </StackPanel>

                <CheckBox Name="TickExcludeVideos" Content="Exclude videos"/>
                <CheckBox Name="TickGroupExports" Content="Group song folders by release version"/>
                <!-- <CheckBox Content="Delete original files"/> -->

                <TextBlock Margin="0 24 0 4" Text="# Concurrent Operations"/>
                <StackPanel Orientation="Horizontal">
                    <TextBox Name="NumThreads" Width="36" HorizontalAlignment="Left"/>
                    <TextBlock VerticalAlignment="Center" Padding="4 0 0 0">
                        <Run Text="/"/>
                        <Run Text="{x:Static util:Utils.CoreCount}"/>
                    </TextBlock>
                </StackPanel>

            </StackPanel>
            <StackPanel Grid.Row="1" >
                <Button Name="BtnExport" HorizontalAlignment="Stretch" Command="{Binding OnExportClick}">
                    <TextBlock Text="Export" TextAlignment="Center"/>
                </Button>
            </StackPanel>
        </Grid>

        <UserControl Background="{DynamicResource DataGridContentBackground}">
            <DataGrid Name="ListingTable" IsReadOnly="True" ItemsSource="{Binding Rows}"
                CanUserResizeColumns="True" CanUserSortColumns="False" 
            >
                <DataGrid.Columns>
                    <DataGridTemplateColumn Header="Status">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Image Source="{Binding StatusImg}" Height="24"/>
                                <!-- TODO -->
                                <!-- <UserControl Content="{Binding StatusContent}" Height="24"/> -->
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>

                    <DataGridTextColumn Header="ID" Width="90" Binding="{Binding Song.Id}"/>
                    <DataGridTextColumn Header="Title" Width="*" Binding="{Binding Song.Name}"/>
                    <DataGridTextColumn Header="Artist" Width="*" Binding="{Binding Song.Artist}"/>
                </DataGrid.Columns>
                <DataGrid.Styles>
                    <Style Selector="DataGridCell">
                        <Setter Property="ToolTip.Tip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content.Text}" />
                    </Style>
                </DataGrid.Styles>
            </DataGrid>
        </UserControl>
    </DockPanel>
</Panel>