<Page 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:ForzaUI"
      x:Name="page"
      x:Class="ForzaUI.A_RivalsResultsMenu"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

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

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

            <Thickness x:Key="A_Thickness_Margin">18,16</Thickness>
            
            <Style x:Key="A_Style_FZMaterial_AcrylicPanel_Rivals"
                   TargetType="local:FZMaterial"
                   BasedOn="{StaticResource A_Style_FZMaterial_FlatPanel_HeaderPill}" />

            <Style x:Key="A_Style_FZTextBlock_PostRace_BonusText"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
                <Setter Property="Color"
                        Value="#FFFFFF" />
                <Setter Property="CapHeight"
                        Value="41" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_Label"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_PostRace_BonusText}">
                <Setter Property="Margin" Value="{StaticResource A_Thickness_Margin}" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_RivalName"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_PostRace_TotalText}">
                <Setter Property="CapHeight" Value="84" />
                <Setter Property="Margin" Value="50,40,50,43" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_Time"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_Label}">
                <Setter Property="CapHeight"
                        Value="34" />
                <Setter Property="VerticalAlignment"
                        Value="Center" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_YourTime_Split"
                   TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_Time}">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_HUD_HighlightText}" />
                <Setter Property="CapHeight"
                        Value="34" />
            </Style>

            <Style x:Key="A_Style_FZMaterial_RivalResultsMenuDirtyIcon"
                   TargetType="local:FZMaterial">
                <Setter Property="Visibility"
                        Value="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                <Setter Property="ImageSource"
                        Value="/ForzaUI;component/Textures/Anthem/Icons/RivalsLeaderboard/Dirty_Lap.png" />
                <Setter Property="Width"
                        Value="32" />
                <Setter Property="Height"
                        Value="32" />
                <Setter Property="VerticalAlignment"
                        Value="Center" />
                <Setter Property="Margin"
                        Value="16,0,0,0" />
            </Style>

        </ResourceDictionary>
    </Page.Resources>
   
    <Border x:Name="LayoutRoot">
        <Grid>
            <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
                <ContentControl x:Name="DefaultHelpPanel"
                    local:ControllerButtonPanel.ADescription="{local:Loc HelpButtons.IDS_BeatenRivalMenu_CollectReward}"
                    local:ControllerButtonPanel.XDescription="{local:Loc HelpButtons.IDS_BeatenRivalMenu_ContinueLapping}"
                    Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
            </ContentControl>

            <Decorator Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
                <StackPanel HorizontalAlignment="Left" 
                        Orientation="Vertical" Margin="190,208,0,0">

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

                    <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}" 
                               Margin="0,0,0,9" HorizontalAlignment="Left"
                               Visibility="{Binding HasRival, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_Rivals}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Label}"
                                           Text="{Binding RivalResultIntroText}" />
                        </local:FZMaterial>
                    </Decorator>

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

                    <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_3}" HorizontalAlignment="Left">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="8" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="18" />
                            <ColumnDefinition />
                            <ColumnDefinition Width="18" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FlatPanel_LeftHeaderPanel}"
                                          Grid.Row="0" Grid.Column="0"
                                          Visibility="{Binding HasRival, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Label}"
                                           Text="{local:Loc Rivals.IDS_RivalTime}" />
                        </local:FZMaterial>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_NonInteractive}"
                                          Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                                          Grid.Row="0" Grid.Column="2"
                                          Visibility="{Binding HasRival, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                            <StackPanel Orientation="Horizontal" Margin="{StaticResource A_Thickness_Margin}">
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Time}"
                                                   Margin="0"
                                                   Text="{Binding RivalTime}"/>
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_RivalResultsMenuDirtyIcon}"
                                                  Tag="{Binding RivalTimeIsDirty}"/>
                            </StackPanel>
                        </local:FZMaterial>

                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FlatPanel_LeftHeaderPanel}"
                                          Grid.Row="2" Grid.Column="0">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Label}"
                                           Text="{local:Loc Rivals.IDS_YourTime}" />
                        </local:FZMaterial>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_NonInteractive}"
                                          Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                                          Grid.Row="2" Grid.Column="2">
                            <StackPanel Orientation="Horizontal" Margin="{StaticResource A_Thickness_Margin}">
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Time}"
                                                   Margin="0"
                                                   Text="{Binding YourTime}" />
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_RivalResultsMenuDirtyIcon}"
                                                  Tag="{Binding YourTimeIsDirty}"/>
                            </StackPanel>
                        </local:FZMaterial>

                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_NonInteractive}"
                                          Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                                          Grid.Row="2" Grid.Column="4"
                                          Visibility="{Binding HasRival, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_YourTime_Split}"
                                        Text="{Binding YourTimeSplit}" />
                        </local:FZMaterial>
                    </Grid>
                </StackPanel>
            </Decorator>
        </Grid>
    </Border>
</Page>
