<Page xmlns:local="clr-namespace:ForzaUI"
      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:System="clr-namespace:System;assembly=mscorlib"
      x:Class="ForzaUI.A_PostRaceRivalsChallengeChoice"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_NoAudio}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <ResourceDictionary>
            <Size x:Key="A_Size_GamerPicSizeParams">215,215</Size>

            <Style x:Key="A_Style_FZMaterial_AcrylicPanel_Rivals"
                   TargetType="local:FZMaterial"
                   BasedOn="{StaticResource A_Style_FZMaterial_AcrylicPanel_Highlight}" />

            <Style x:Key="A_Style_FZTextBlock_RaceYourRival"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_PostRace_BonusText}">
                <Setter Property="FontSize" Value="58" />
                <Setter Property="Margin" Value="24,15" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_RivalName"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_PostRace_TotalText}">
                <Setter Property="FontSize" Value="122" />
                <Setter Property="Margin" Value="46,40" />
            </Style>

            <Thickness x:Key="A_Thickness_Margin">27,21</Thickness>
            
            <Style x:Key="A_Style_FZTextBlock_TargetTime"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_PostRace_TotalText}">
                <Setter Property="FontSize" Value="73" />
                <Setter Property="Margin" Value="{StaticResource A_Thickness_Margin}" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_TargetTime_Split"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_TargetTime}">
                <Setter Property="Color" Value="#FF00E2FF" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_Reward"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_PostRace_TotalText}">
                <Setter Property="FontSize" Value="73" />
                <Setter Property="Margin" Value="{StaticResource A_Thickness_Margin}" />
            </Style>
        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl x:Name="DefaultHelpPanel"
                    Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Decorator Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <StackPanel VerticalAlignment="Center" HorizontalAlignment="Left" 
                        Orientation="Vertical" Margin="190,-70,0,0">

                <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                    <ContentControl Content="{local:Loc ScreenTitles.IDS_PostRaceRivalOffer}"
                                    HorizontalAlignment="Left"
                                    Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                    local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Rivals.png" Margin="0,0,0,58" />
                </Decorator>

                <Grid>
                    <StackPanel Orientation="Vertical" VerticalAlignment="Top" >
                        <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}"
                           HorizontalAlignment="Left" Margin="0,0,0,9">
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_Rivals}">
                                <Grid>
                                    <StackPanel Orientation="Horizontal" Visibility="{Binding IsRivalAvailable, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}">
                                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_RaceYourRival}"
                                           Text="{local:Loc InGame.IDS_Rival_DownloadingRival}" />

                                        <ProgressBar x:Name="A_Spinner"
                                                     Style="{StaticResource A_Style_Progressbar_Loading_SmallSpinner}" Height="40" Width="40"
                                                     VerticalAlignment="Center"
                                                     Margin="10,0,15,0"/>
                                    </StackPanel>
                                    <local:FZTextBlock Visibility="{Binding IsRivalAvailable, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                            Style="{StaticResource A_Style_FZTextBlock_RaceYourRival}"
                                            Text="{Binding WantToRaceMessage}" />

                                </Grid>
                            </local:FZMaterial>
                        </Decorator>

                        <StackPanel Orientation="Vertical" VerticalAlignment="Top" >
                            <StackPanel.Style>
                                <Style TargetType="FrameworkElement" BasedOn="{StaticResource A_Style_FrameworkElement_DefaultTransition}">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsRivalInitiallyAvailable}" Value="False">
                                            <Setter Property="Opacity" Value="0" />
                                            <Setter Property="local:ZPanel.ZOffset" Value="{StaticResource A_Double_TransitionZOffset_Inwards}" />
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding IsRivalAvailable}" Value="True">
                                            <DataTrigger.EnterActions>
                                                <BeginStoryboard Storyboard="{StaticResource transition_in}" />
                                            </DataTrigger.EnterActions>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>

                            <StackPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_2}" Orientation="Horizontal" Margin="0,0,0,9">
                                <local:FZMaterial ImageSource="{Binding UserProfile, Converter={StaticResource A_GamerPicConverter}, ConverterParameter={StaticResource A_Size_GamerPicSizeParams}}"
                                                  Width="{Binding ActualHeight, RelativeSource={RelativeSource Self}}" />
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_PostRace_RewardBoxPanel}">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_RivalName}" MaxWidth="1300"
                                            Text="{Binding UserProfile.FormattedGamertag}"/>
                                </local:FZMaterial>
                            </StackPanel>

                            <StackPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_3}" Orientation="Horizontal" Margin="0,0,0,49">
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_Rivals}" Margin="0,0,9,0">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_TargetTime}"
                                       Text="{local:Loc InGame.IDS_Rival_Target}" />
                                </local:FZMaterial>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_PostRace_RewardBoxPanel}" Margin="0,0,9,0">
                                    <StackPanel Orientation="Horizontal" Margin="{StaticResource A_Thickness_Margin}">
                                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_TargetTime}"
                                                           Margin="0"
                                                           Text="{Binding TargetTime}" />
                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_RivalDirtyIcon}"
                                                          Tag="{Binding TargetTimeIsDirty}" />
                                    </StackPanel>
                                </local:FZMaterial>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_PostRace_RewardBoxPanel}"
                                      Visibility="{Binding TargetSplit, Converter={StaticResource A_StringVisConverter}}">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_TargetTime_Split}"
                                            Text="{Binding TargetSplit}" />
                                </local:FZMaterial>
                            </StackPanel>

                            <StackPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_4}" Orientation="Horizontal">
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_Rivals}" Margin="0,0,9,0">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Reward}"
                                           Text="{local:Loc InGame.IDS_Reward}" />
                                </local:FZMaterial>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_Tile_Background}"
                                      ImageSource="/ForzaUI;component/Textures/Anthem/Icons/CRIcon/CR_128.png"
                                      Width="{Binding ActualHeight, RelativeSource={RelativeSource Self}}" />

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_PostRace_RewardBoxPanel}">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Reward}"
                                        Text="{Binding CreditsRewardValue}" />
                                </local:FZMaterial>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </StackPanel>
        </Decorator>
    </Grid>
</Page>
