<Window x:Class="SharepointToolbox.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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:loc="clr-namespace:SharepointToolbox.Localization"

        xmlns:views="clr-namespace:SharepointToolbox.Views.Tabs"
        mc:Ignorable="d"
        Title="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[app.title]}"
        Icon="pack://application:,,,/Resources/SPToolbox-logo-ico.png"
        Background="{DynamicResource AppBgBrush}"
        Foreground="{DynamicResource TextBrush}"
        TextOptions.TextFormattingMode="Ideal"
        MinWidth="900" MinHeight="600" Height="700" Width="1100">
  <DockPanel>
    <!-- Toolbar -->
    <ToolBar DockPanel.Dock="Top">
      <ComboBox Width="220" ItemsSource="{Binding TenantProfiles}"
                SelectedItem="{Binding SelectedProfile}"
                DisplayMemberPath="Name" />
      <Button Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[toolbar.manage]}"
              Command="{Binding ManageProfilesCommand}" />
      <Separator />
      <Button Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[toolbar.clear]}"
              Command="{Binding ClearSessionCommand}" />
      <Separator />
      <Button Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[toolbar.selectSites]}"
              Command="{Binding OpenGlobalSitePickerCommand}"
              ToolTip="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[toolbar.selectSites.tooltip]}" />
      <TextBlock Text="{Binding GlobalSitesSelectedLabel}"
                 VerticalAlignment="Center" Margin="6,0,0,0"
                 Foreground="{DynamicResource TextMutedBrush}" />
    </ToolBar>

    <!-- StatusBar: tenant name | operation status text | progress % -->
    <StatusBar DockPanel.Dock="Bottom" Height="24">
      <StatusBarItem Content="{Binding SelectedProfile.Name}" />
      <Separator />
      <StatusBarItem Content="{Binding ProgressStatus}" />
      <Separator />
      <StatusBarItem Content="{Binding ProgressPercentage, StringFormat={}{0}%}" />
    </StatusBar>

    <!-- Log Panel -->
    <RichTextBox x:Name="LogPanel" DockPanel.Dock="Bottom" Height="150"
                 IsReadOnly="True" VerticalScrollBarVisibility="Auto"
                 Background="Black" Foreground="LimeGreen"
                 FontFamily="Consolas" FontSize="11" />

    <!-- TabControl -->
    <TabControl>
      <TabItem x:Name="PermissionsTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.permissions]}">
      </TabItem>
      <TabItem x:Name="StorageTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.storage]}">
      </TabItem>
      <TabItem x:Name="SearchTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.search]}">
      </TabItem>
      <TabItem x:Name="DuplicatesTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.duplicates]}">
      </TabItem>
      <TabItem x:Name="VersionsTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.versions]}">
      </TabItem>
      <TabItem x:Name="TransferTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.transfer]}">
      </TabItem>
      <TabItem x:Name="BulkMembersTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.bulkMembers]}">
      </TabItem>
      <TabItem x:Name="BulkSitesTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.bulkSites]}">
      </TabItem>
      <TabItem x:Name="FolderStructureTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.folderStructure]}">
      </TabItem>
      <TabItem x:Name="TemplatesTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.templates]}">
      </TabItem>
      <!-- Phase 7: User Access Audit tab: content set from code-behind via DI-resolved UserAccessAuditView -->
      <TabItem x:Name="UserAccessAuditTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.userAccessAudit]}">
      </TabItem>
      <!-- Settings tab: content set from code-behind via DI-resolved SettingsView -->
      <TabItem x:Name="SettingsTabItem"
               Header="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[tab.settings]}">
      </TabItem>
    </TabControl>
  </DockPanel>
</Window>
