<ui:Page xmlns:props="clr-namespace:Ink_Canvas.Properties" x:Class="Ink_Canvas.Windows.SettingsViews.Pages.BackupPage"
      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:local="clr-namespace:Ink_Canvas.Windows.SettingsViews.Pages"
      xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
      xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"
      xmlns:controls="clr-namespace:Ink_Canvas.Controls;assembly=InkCanvas.Controls"
      mc:Ignorable="d"
      Title="{x:Static props:StorageStrings.Backup_Title}">

    <ScrollViewer PanningMode="VerticalFirst">
        <Grid Margin="59,0,59,0">
            <FrameworkElement.Resources>
                <sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
                <Style x:Key="SettingsSectionHeaderTextBlockStyle"
                    BasedOn="{StaticResource BodyStrongTextBlockStyle}"
                    TargetType="TextBlock">
                    <Style.Setters>
                        <Setter Property="Margin" Value="1,30,0,6" />
                    </Style.Setters>
                </Style>
            </FrameworkElement.Resources>
            <Grid>
                <ikw:SimpleStackPanel MaxWidth="1000"
                    HorizontalAlignment="Stretch"
                    Spacing="{StaticResource SettingsCardSpacing}">

                    <controls:LabeledSettingsCard x:Name="ToggleSwitchIsAutoBackupBeforeUpdate"
                        Header="{x:Static props:StorageStrings.Backup_AutoBeforeUpdate}"
                        IsOn="True"
                        Toggled="ToggleSwitchIsAutoBackupBeforeUpdate_Toggled"/>

                    <ui:SettingsExpander x:Name="ExpanderAutoBackup"
                                         Header="{x:Static props:StorageStrings.Backup_AutoPeriodic}"
                                         IsExpanded="{Binding IsOn, ElementName=ToggleSwitchIsAutoBackupEnabled, Mode=OneWay}">
                        <ui:ToggleSwitch x:Name="ToggleSwitchIsAutoBackupEnabled"
                                         Toggled="ToggleSwitchIsAutoBackupEnabled_Toggled"/>
                        <ui:SettingsExpander.Items>
                            <ui:SettingsCard Header="{x:Static props:StorageStrings.Backup_Interval}"
                                             Description="{x:Static props:StorageStrings.Backup_Interval_DefaultHint}">
                                <ComboBox x:Name="ComboBoxAutoBackupInterval"
                                          SelectionChanged="ComboBoxAutoBackupInterval_SelectionChanged">
                                    <ComboBoxItem Content="{x:Static props:StorageStrings.Backup_Interval_1Day}" Tag="1" />
                                    <ComboBoxItem Content="{x:Static props:StorageStrings.Backup_Interval_3Days}" Tag="3" />
                                    <ComboBoxItem Content="{x:Static props:StorageStrings.Backup_Interval_7Days}" Tag="7" IsSelected="True" />
                                    <ComboBoxItem Content="{x:Static props:StorageStrings.Backup_Interval_14Days}" Tag="14" />
                                    <ComboBoxItem Content="{x:Static props:StorageStrings.Backup_Interval_30Days}" Tag="30" />
                                </ComboBox>
                            </ui:SettingsCard>
                        </ui:SettingsExpander.Items>
                    </ui:SettingsExpander>

                    <ui:SettingsExpander Header="{x:Static props:StorageStrings.Backup_Manual}"
                                         IsExpanded="True">
                        <ui:SettingsExpander.Items>
                            <ui:SettingsCard Header="{x:Static props:StorageStrings.Backup_Manual}"
                                             IsClickEnabled="True" Click="BtnManualBackup_Click">
                                <ui:SettingsCard.HeaderIcon>
                                    <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Sync}" />
                                </ui:SettingsCard.HeaderIcon>
                            </ui:SettingsCard>
                            <ui:SettingsCard Header="{x:Static props:StorageStrings.Backup_Restore}"
                                             IsClickEnabled="True" Click="BtnRestoreBackup_Click">
                                <ui:SettingsCard.HeaderIcon>
                                    <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.History}" />
                                </ui:SettingsCard.HeaderIcon>
                            </ui:SettingsCard>
                        </ui:SettingsExpander.Items>
                    </ui:SettingsExpander>

                    <Rectangle Height="48" />

                </ikw:SimpleStackPanel>
            </Grid>
        </Grid>
    </ScrollViewer>
</ui:Page>
