<ContentDialog
    x:Class="Wino.Dialogs.SystemFolderConfigurationDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:Wino.Controls"
    xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
    xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:domain="using:Wino.Core.Domain"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="{x:Bind domain:Translator.SettingsConfigureSpecialFolders_Title}"
    Closing="DialogClosing"
    DefaultButton="Primary"
    IsPrimaryButtonEnabled="True"
    PrimaryButtonClick="SaveClicked"
    PrimaryButtonText="{x:Bind domain:Translator.Buttons_SaveConfiguration}"
    SecondaryButtonClick="CancelClicked"
    SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
    Style="{StaticResource WinoDialogStyle}"
    mc:Ignorable="d">

    <ContentDialog.Resources>
        <Style TargetType="ComboBox">
            <Setter Property="Width" Value="140" />
        </Style>
    </ContentDialog.Resources>
    <ScrollViewer>
        <Grid RowSpacing="16">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <TextBlock Style="{StaticResource BodyTextBlockStyle}">
                <Run Text="{x:Bind domain:Translator.SystemFolderConfigDialog_MessageFirstLine}" />
                <LineBreak />
                <LineBreak />
                <Run
                    FontWeight="SemiBold"
                    Foreground="{StaticResource SystemErrorTextColor}"
                    Text="{x:Bind domain:Translator.SystemFolderConfigDialog_MessageSecondLine}" />
            </TextBlock>

            <StackPanel Grid.Row="1" Spacing="8">
                <controls1:SettingsCard
                    x:Name="SentCard"
                    Description="{x:Bind domain:Translator.SystemFolderConfigDialog_SentFolderDescription}"
                    Header="{x:Bind domain:Translator.SystemFolderConfigDialog_SentFolderHeader}">
                    <controls1:SettingsCard.HeaderIcon>
                        <coreControls:WinoFontIcon FontSize="16" Icon="SpecialFolderSent" />
                    </controls1:SettingsCard.HeaderIcon>
                    <ComboBox ItemsSource="{x:Bind AvailableFolders}" SelectedItem="{x:Bind Sent, Mode=TwoWay}" />
                </controls1:SettingsCard>

                <controls1:SettingsCard
                    x:Name="DraftCard"
                    Description="{x:Bind domain:Translator.SystemFolderConfigDialog_DraftFolderDescription}"
                    Header="{x:Bind domain:Translator.SystemFolderConfigDialog_DraftFolderHeader}">
                    <controls1:SettingsCard.HeaderIcon>
                        <coreControls:WinoFontIcon FontSize="16" Icon="SpecialFolderDraft" />
                    </controls1:SettingsCard.HeaderIcon>
                    <ComboBox ItemsSource="{x:Bind AvailableFolders}" SelectedItem="{x:Bind Draft, Mode=TwoWay}" />
                </controls1:SettingsCard>

                <controls1:SettingsCard
                    x:Name="ArchiveCard"
                    Description="{x:Bind domain:Translator.SystemFolderConfigDialog_ArchiveFolderDescription}"
                    Header="{x:Bind domain:Translator.SystemFolderConfigDialog_ArchiveFolderHeader}">
                    <controls1:SettingsCard.HeaderIcon>
                        <coreControls:WinoFontIcon FontSize="16" Icon="SpecialFolderArchive" />
                    </controls1:SettingsCard.HeaderIcon>
                    <ComboBox ItemsSource="{x:Bind AvailableFolders}" SelectedItem="{x:Bind Archive, Mode=TwoWay}" />
                </controls1:SettingsCard>

                <controls1:SettingsCard
                    x:Name="DeletedCard"
                    Description="{x:Bind domain:Translator.SystemFolderConfigDialog_DeletedFolderDescription}"
                    Header="{x:Bind domain:Translator.SystemFolderConfigDialog_DeletedFolderHeader}">
                    <controls1:SettingsCard.HeaderIcon>
                        <coreControls:WinoFontIcon FontSize="16" Icon="SpecialFolderDeleted" />
                    </controls1:SettingsCard.HeaderIcon>
                    <ComboBox ItemsSource="{x:Bind AvailableFolders}" SelectedItem="{x:Bind Trash, Mode=TwoWay}" />
                </controls1:SettingsCard>

                <controls1:SettingsCard
                    x:Name="JunkCard"
                    Description="{x:Bind domain:Translator.SystemFolderConfigDialog_JunkFolderDescription}"
                    Header="{x:Bind domain:Translator.SystemFolderConfigDialog_JunkFolderHeader}">
                    <controls1:SettingsCard.HeaderIcon>
                        <coreControls:WinoFontIcon FontSize="16" Icon="SpecialFolderJunk" />
                    </controls1:SettingsCard.HeaderIcon>
                    <ComboBox ItemsSource="{x:Bind AvailableFolders}" SelectedItem="{x:Bind Junk, Mode=TwoWay}" />
                </controls1:SettingsCard>

                <Border
                    x:Name="ValidationErrorBorder"
                    Padding="12,8"
                    Background="{ThemeResource SystemFillColorCriticalBackgroundBrush}"
                    CornerRadius="4"
                    Visibility="Collapsed">
                    <TextBlock x:Name="ValidationErrorTextBlock" Foreground="{StaticResource SystemErrorTextColor}" />
                </Border>
            </StackPanel>
        </Grid>
    </ScrollViewer>
</ContentDialog>
