<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:RomRepoMgr.ViewModels;assembly=RomRepoMgr"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:resources="clr-namespace:RomRepoMgr.Resources"
        mc:Ignorable="d"
        x:Class="RomRepoMgr.Views.MainWindow"
        Icon="/Assets/avalonia-logo.ico"
        Title="RomRepoMgr">
    <Design.DataContext>
        <vm:MainWindowViewModel />
    </Design.DataContext>
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="{x:Static resources:Localization.FileMenuText}">
                <MenuItem Header="{x:Static resources:Localization.FileMenuImportDatFileText}"
                          Command="{Binding ImportDatCommand, Mode=OneWay}" />
                <Separator />
                <MenuItem Header="{x:Static resources:Localization.FileMenuImportDatFolderText}"
                          Command="{Binding ImportDatFolderCommand, Mode=OneWay}" />
                <Separator />
                <MenuItem Header="{x:Static resources:Localization.FileMenuSettingsText}"
                          IsVisible="{Binding !NativeMenuSupported, Mode=OneWay}"
                          Command="{Binding SettingsCommand, Mode=OneWay}" />
                <Separator />
                <MenuItem Header="{x:Static resources:Localization.FileMenuExitText}"
                          IsVisible="{Binding !NativeMenuSupported, Mode=OneWay}"
                          Command="{Binding ExitCommand, Mode=OneWay}" />
            </MenuItem>
            <MenuItem Header="{x:Static resources:Localization.FilesystemMenuText}">
                <MenuItem Header="{x:Static resources:Localization.FilesystemMenuMountText}"
                          Command="{Binding MountCommand, Mode=OneWay}"
                          IsEnabled="{Binding Vfs, Converter={x:Static ObjectConverters.IsNull}, Mode=OneWay}" />
                <Separator />
                <MenuItem Header="{x:Static resources:Localization.FilesystemMenuUmountText}"
                          Command="{Binding UmountCommand, Mode=OneWay}"
                          IsEnabled="{Binding Vfs, Converter={x:Static ObjectConverters.IsNotNull}, Mode=OneWay}" />
                <Separator />
            </MenuItem>
            <MenuItem Header="{x:Static resources:Localization.RomsMenuText}">
                <MenuItem Header="{x:Static resources:Localization.RomsMenuImportText}"
                          Command="{Binding ImportRomFolderCommand, Mode=OneWay}" />
                <Separator />
            </MenuItem>
            <MenuItem Header="{x:Static resources:Localization.RomSetsMenuText}"
                      IsEnabled="{Binding SelectedRomSet, Converter={x:Static ObjectConverters.IsNotNull}, Mode=OneWay}">
                <MenuItem Header="{x:Static resources:Localization.RomSetsMenuSaveRomsText}"
                          Command="{Binding ExportRomsCommand, Mode=OneWay}" />
                <Separator />
                <MenuItem Header="{x:Static resources:Localization.RomSetsMenuSaveDatText}"
                          Command="{Binding ExportDatCommand, Mode=OneWay}" />
                <Separator />
                <MenuItem Header="{x:Static resources:Localization.RomSetsMenuEditText}"
                          Command="{Binding EditRomSetCommand, Mode=OneWay}" />
                <Separator />
                <MenuItem Header="{x:Static resources:Localization.RomSetsMenuDeleteText}"
                          Command="{Binding DeleteRomSetCommand, Mode=OneWay}" />
                <Separator />
            </MenuItem>
            <MenuItem Header="{x:Static resources:Localization.DatabaseMenuText}">
                <MenuItem Header="{x:Static resources:Localization.DatabaseMenuUpdateStatsText}"
                          Command="{Binding UpdateStatsCommand, Mode=OneWay}" />
                <Separator />
            </MenuItem>
            <MenuItem Header="{x:Static resources:Localization.HelpMenuText}">
                <MenuItem Header="{x:Static resources:Localization.HelpMenuAboutText}"
                          Name="AboutMenuItem"
                          IsVisible="{Binding !NativeMenuSupported, Mode=OneWay}"
                          Command="{Binding AboutCommand, Mode=OneWay}" />
            </MenuItem>
        </Menu>
        <TabControl HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch">
            <TabItem>
                <TabItem.Header>
                    <TextBlock Text="{x:Static resources:Localization.RomSets}" />
                </TabItem.Header>
                <DataGrid ItemsSource="{Binding RomSets, Mode=OneWay}"
                          HorizontalScrollBarVisibility="Visible"
                          SelectedItem="{Binding SelectedRomSet, Mode=TwoWay}"
                          CanUserSortColumns="True"
                          CanUserResizeColumns="True">
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding Name, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetNameLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Version, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetVersionLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Author, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetAuthorLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Category, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetCategoryLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Date, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetDateLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Description, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetDescriptionLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Comment, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetCommentLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Homepage, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.HomepageLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding TotalMachines, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetTotalMachinesLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding CompleteMachines, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetCompleteMachinesLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding IncompleteMachines, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetIncompleteMachinesLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding TotalRoms, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetTotalRomsLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding HaveRoms, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetHaveRomsLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding MissRoms, Mode=OneWay}"
                                            Width="Auto"
                                            IsReadOnly="True">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{x:Static resources:Localization.RomSetMissRomsLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>