<UserControl x:Class="Hearthstone_Deck_Tracker.FlyoutControls.Options.HSReplay.HSReplayAccount"
             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"
             mc:Ignorable="d" 
             DataContext="{Binding RelativeSource={RelativeSource Self}}"
             d:DesignHeight="500" d:DesignWidth="300">
    <StackPanel Margin="20">
        <StackPanel Visibility="{Binding IsAuthenticated, Converter={StaticResource InverseBoolToVisibility}}">
            <TextBlock TextWrapping="Wrap" TextAlignment="Center"
                       FontSize="16" FontWeight="SemiBold"
                       Text="{lex:Loc Options_HSReplay_Account_LoginPrompt1}"
                       Visibility="{Binding LoginInfoVisibility}"/>
            <TextBlock TextWrapping="Wrap" FontWeight="SemiBold"
                       TextAlignment="Center" FontSize="16"
                       Visibility="{Binding ReplaysClaimedVisibility}">
                <Run Text="{lex:Loc Options_HSReplay_Account_LoginPrompt2}"/>
                <LineBreak/>
                <Run FontSize="15" FontWeight="Normal" Text="{lex:Loc Options_HSReplay_Account_ReplayInfo}"/>
                <Hyperlink Command="{Binding AccountSettingsCommand}">
                    <Run Text="{Binding Username, Mode=OneWay}"/>
                </Hyperlink>.
             </TextBlock>
            <controls:OAuthLogin Margin="25"/>
        </StackPanel>
        <StackPanel Visibility="{Binding IsAuthenticated, Converter={StaticResource BoolToVisibility}}">
            <Grid HorizontalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.Resources>
                    <Style TargetType="TextBlock">
                        <Setter Property="FontSize" Value="16"/>
                        <Setter Property="FontWeight" Value="SemiBold"/>
                    </Style>
                    <Style TargetType="controls:StatusIndicator">
                        <Setter Property="Margin" Value="5"/>
                    </Style>
                    <Style TargetType="StackPanel">
                        <Setter Property="Margin" Value="5"/>
                    </Style>
                </Grid.Resources>
                <controls:StatusIndicator Grid.Row="0" Grid.Column="0" Success="True"/>
                <TextBlock Grid.Row="0" Grid.Column="1" Margin="5">
                    <Run Text="{lex:Loc Options_HSReplay_Account_LoggedInAs}"/>
                    <Run Text="{Binding Username, Mode=OneWay}"/>
                </TextBlock>
                <controls:StatusIndicator Grid.Row="1" Grid.Column="0"
                                          Success="{Binding CollectionSyncingEnabled, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
                <StackPanel Grid.Row="1" Grid.Column="1">
                    <TextBlock Text="{lex:Loc Options_HSReplay_Account_CollectionUploading}"/>
                    <TextBlock FontSize="12" Visibility="{Binding CollectionSyncingEnabled, Converter={StaticResource InverseBoolToVisibility}}">
                        <Hyperlink Command="{Binding EnableCollectionSyncingCommand}">
                            <Run Text="{lex:Loc Options_HSReplay_Account_EnableNow}" FontSize="12"/>
                        </Hyperlink>
                    </TextBlock>
                </StackPanel>
                <controls:StatusIndicator Grid.Row="2" Grid.Column="0"
                                          Success="{Binding ReplayUploadingEnabled, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
                <StackPanel Grid.Row="2" Grid.Column="1" Margin="5">
                    <TextBlock Text="{lex:Loc Options_HSReplay_Account_ReplayUploading}"/>
                    <TextBlock FontSize="12" Visibility="{Binding ReplayUploadingEnabled, Converter={StaticResource InverseBoolToVisibility}}">
                        <Hyperlink Command="{Binding EnableReplayUploadingCommand}">
                            <Run Text="{lex:Loc Options_HSReplay_Account_EnableNow}" FontSize="12"/>
                        </Hyperlink>
                    </TextBlock>
                </StackPanel>
                <controls:StatusIndicator Grid.Row="3" Grid.Column="0"
                                          Visibility="{Binding UploadTokenUnclaimed, Converter={StaticResource BoolToVisibility}, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                          Success="False"/>
                <StackPanel Grid.Row="3" Grid.Column="1" Margin="5" Visibility="{Binding UploadTokenUnclaimed, Converter={StaticResource BoolToVisibility}}">
                    <TextBlock Text="{lex:Loc Options_HSReplay_Account_ReplaysClaimed}"/>
                    <TextBlock FontSize="12" IsEnabled="{Binding ClaimTokenButtonEnabled}">
                        <Hyperlink Command="{Binding ClaimUploadTokenCommand}">
                            <Run Text="{lex:Loc Options_HSReplay_Account_ClaimNow}" FontSize="12"/>
                        </Hyperlink>
                    </TextBlock>
                </StackPanel>
                <controls:StatusIndicator Grid.Row="4" Grid.Column="0"
                                          Success="{Binding HasSubscription, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
                <StackPanel Grid.Row="4" Grid.Column="1">
                    <TextBlock Text="{Binding SubscriptionStatusText}"/>
                    <TextBlock Text="{lex:Loc Options_HSReplay_Account_Subscription_Thanks}" FontSize="12" Foreground="#FFB00D"
                               Visibility="{Binding HasSubscription, Converter={StaticResource BoolToVisibility}}"/>
                    <TextBlock FontSize="12" Visibility="{Binding HasSubscription, Converter={StaticResource InverseBoolToVisibility}}">
                        <Hyperlink Command="{Binding PremiumInfoCommand}">
                            <Run Text="{lex:Loc Options_HSReplay_Account_Subscription_LearnMore}"/>
                        </Hyperlink>
                    </TextBlock>
                </StackPanel>
            </Grid>
            <Button HorizontalAlignment="Center" Width="200" Content="{lex:Loc Options_HSReplay_Account_AccountSettings}" Margin="0,15,0,0"
                    Command="{Binding AccountSettingsCommand}"/>
            <TextBlock TextWrapping="Wrap" TextAlignment="Center" Margin="0,20,0,0"
                       Visibility="{Binding LogoutWarningVisibility}">
                <Run FontWeight="SemiBold" FontSize="14" Text="{lex:Loc Options_HSReplay_Account_Logout_Confirmation}"/>
                <LineBreak/>
                <Run Text="{lex:Loc Options_HSReplay_Account_Logout_Info1}"/>
                <LineBreak/>
                <Run Text="{lex:Loc Options_HSReplay_Account_Logout_Info2}"></Run>
            </TextBlock>
            <Button HorizontalAlignment="Center" Width="200" Content="{lex:Loc Options_HSReplay_Account_Logout}" Margin="0,10,0,0"
                    IsEnabled="{Binding LogoutButtonEnabled}"
                    Command="{Binding LogoutCommand}">
                <Button.Background>
                    <SolidColorBrush Color="Red" Opacity="0.5"/>
                </Button.Background>
            </Button>
        </StackPanel>
    </StackPanel>
</UserControl>
