<UserControl x:Class="Hearthstone_Deck_Tracker.FlyoutControls.Options.HSReplay.HSReplayCollection"
             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:controls="clr-namespace:Hearthstone_Deck_Tracker.Controls"
             xmlns:lex="http://wpflocalizeextension.codeplex.com"
             xmlns:s="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             DataContext="{Binding RelativeSource={RelativeSource Self}}"
             d:DesignHeight="500" d:DesignWidth="500">
    <StackPanel Margin="20">
        <StackPanel Visibility="{Binding IsAuthenticated, Converter={StaticResource InverseBoolToVisibility}}">
            <TextBlock TextAlignment="Center" FontWeight="SemiBold" FontSize="16">
                <Run Text="{lex:Loc Options_HSReplay_Collection_HeaderText}"/>
                <LineBreak/>
                <Run Text="{lex:Loc Options_HSReplay_Collection_HeaderText_Subtitle}" FontWeight="Normal" FontSize="15"/>
            </TextBlock>
            <controls:OAuthLogin Margin="25" SuccessUrl="{Binding HSReplayDecksUrl, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
        </StackPanel>
        <StackPanel Visibility="{Binding IsAuthenticated, Converter={StaticResource BoolToVisibility}}">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0"
                        Visibility="{Binding CollectionSynced, Converter={StaticResource BoolToVisibility}}">
                <controls:StatusIndicator Success="{Binding CollectionSyncingEnabled, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                          VerticalAlignment="Center" FontSize="16"/>
                <StackPanel Margin="5,0,0,0" VerticalAlignment="Center">
                    <TextBlock FontSize="16" FontWeight="SemiBold" Text="{lex:Loc Options_HSReplay_Collection_UpToDate}"
                               Visibility="{Binding CollectionUpToDate, Converter={StaticResource BoolToVisibility}}"/>
                    <TextBlock FontSize="16" FontWeight="SemiBold" Text="{lex:Loc Options_HSReplay_Collection_UpdatePending}"
                               Visibility="{Binding CollectionUpdateThrottled, Converter={StaticResource BoolToVisibility}}"/>
                    <TextBlock FontSize="14">
                        <Run Text="{lex:Loc Options_HSReplay_Collection_LastUpdated}"/>
                        <Run Text="{Binding SyncAge, Mode=OneWay}"/>
                    </TextBlock>
                </StackPanel>
            </StackPanel>
            <StackPanel Margin="0,30,0,0">
                <StackPanel.Visibility>
                    <MultiBinding Converter="{StaticResource BoolToVisibility}">
                        <MultiBinding.ConverterParameter>
                            <x:Array Type="{x:Type s:Boolean}">
                                <s:Boolean>False</s:Boolean>
                                <s:Boolean>True</s:Boolean>
                            </x:Array>
                        </MultiBinding.ConverterParameter>
                        <Binding Path="CollectionSyncingEnabled"/>
                        <Binding Path="CollectionSynced"/>
                    </MultiBinding>
                </StackPanel.Visibility>
                <TextBlock TextAlignment="Center" FontWeight="SemiBold" FontSize="18" TextWrapping="Wrap">
                    <Run Text="{lex:Loc Options_HSReplay_Collection_OneMoreStep}" FontSize="14" FontWeight="Normal"/>
                    <LineBreak/>
                    <Run Text="{lex:Loc Options_HSReplay_Collection_OpenCollection}"/>
                </TextBlock>
                <controls:StartHearthstoneButton Margin="0,20,0,0" Width="250"/>
            </StackPanel>
            <Button Style="{DynamicResource AccentedSquareButtonStyle}" HorizontalAlignment="Center"
                    Command="{Binding HSReplayDecksCommand}"
                    BorderThickness="1" BorderBrush="White" Foreground="White" MinWidth="200"
                    Margin="0,40,0,0" Visibility="{Binding CollectionSynced, Converter={StaticResource BoolToVisibility}}">
                <TextBlock Text="{lex:Loc Banner_CollectionSyncing_Subtitle}" VerticalAlignment="Center" TextWrapping="Wrap"
                           HorizontalAlignment="Center" FontSize="14" Margin="20,4"/>
            </Button>
            <StackPanel Margin="0,40,0,0" Visibility="{Binding CollectionSynced, Converter={StaticResource BoolToVisibility}}">
                <CheckBox Content="{lex:Loc Options_HSReplay_Collection_UploadSetting}" HorizontalAlignment="Center"
                          IsChecked="{Binding CollectionSyncingEnabled}"/>
                <TextBlock TextAlignment="Center" Opacity="0.5" Margin="0,10,0,0" TextWrapping="Wrap"
                           Visibility="{Binding CollectionSyncingEnabled, Converter={StaticResource BoolToVisibility}}">
                    <Run Text="{lex:Loc Options_HSReplay_Collection_UpdateInfo_Header}" FontWeight="SemiBold"/>:
                    <LineBreak/>
                    <Run Text="{lex:Loc Options_HSReplay_Collection_UpdateInfo_1}"/>
                    <LineBreak/>
                    <Run Text="{lex:Loc Options_HSReplay_Collection_UpdateInfo_2}"/>
                </TextBlock>
            </StackPanel>
        </StackPanel>
    </StackPanel>
</UserControl>
