<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ForzaUI"
                    xmlns:System="clr-namespace:System;assembly=mscorlib">

    <Style x:Key="A_Style_FZTextblock_RewardPreviewText" TargetType="local:FZTextBlock">
        <Setter Property="FontFamily" Value="Horizon_A"/>
        <Setter Property="CapHeight" Value="14"/>
        <Setter Property="Color" Value="{StaticResource A_Color_White}"/>
        <Setter Property="Effect" Value="{StaticResource A_Effect_HighContrastModeDropShadow}" />
    </Style>

    <Color x:Key="A_Color_FestivalPass_Complete_Text">#BF000000</Color>
    <Color x:Key="A_Color_Default_Reward_Complete_Text">#BF000000</Color>
  
    <Style x:Key="A_Style_AutoScrollPanel_RewardPreviewTitle" BasedOn="{StaticResource A_Style_AutoScrollPanel_Masked}" TargetType="local:AutoScrollPanel">
        <Setter Property="InitialPause" Value="0:0:2.0" />
        <Setter Property="ScrollSeparation" Value="40" />
        <Setter Property="MaxHeight" Value="30" />
        <Setter Property="Orientation" Value="Horizontal" />
        <Setter Property="AnimationContext" Value="{Binding Description}" />
        <Style.Resources>
            <ControlTemplate x:Key="A_ControlTemplate_AutoscrollTemplate_Dynamic">
                <local:FZTextBlock x:Name="RewardTitle"
                                    Text="{Binding Description, Converter={StaticResource A_StringToUpper}}"
                                    Style="{StaticResource A_Style_FZTextblock_RewardPreviewText}" />
                <ControlTemplate.Triggers>
                    <DataTrigger Binding="{Binding DataContext.HasAchievedLeagueRank, RelativeSource={RelativeSource FindAncestor, AncestorType=local:TickerItemsControl}}" Value="True">
                        <Setter TargetName="RewardTitle" Property="Color" Value="{StaticResource A_Color_Default_Reward_Complete_Text}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=(local:BindingProxy.A), RelativeSource={RelativeSource AncestorType=local:AutoScrollPanel}}" Value="Gold">
                      <Setter TargetName="RewardTitle" Property="Color" Value="{DynamicResource A_Color_FestivalPass_Complete_Text}"/>
                    </DataTrigger>

                    <DataTrigger Binding="{Binding Source={StaticResource A_Visibility_ShowForHighContrastOnly}}" Value="{x:Static Visibility.Visible}">
                        <Setter TargetName="RewardTitle" Property="Color" Value="{StaticResource A_Color_White}"/>
                    </DataTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Style.Resources>
    </Style>

    <local:MappingConverter x:Key="A_Converter_Show_Reward_Icon" Default="False">
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Credits}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Currency}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Tokens}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Horn}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.QuickChatPhrase}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.SuperWheelspin}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Wheelspin}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.BarnFindRumour}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.SkillPoints}" Value="True" />
    </local:MappingConverter>

    <!--Custom reward icons for series rewards -->
    <local:MappingConverter x:Key="A_Converter_RewardTypeToSeriesRwardPrizeIcon">
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Credits}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/Credits_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Currency}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/Influence_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Tokens}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/Tokens_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Car}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/Car_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Clothing}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/Clothing_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Horn}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/Horn_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.QuickChatPhrase}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/QuickChat_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Emote}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/Emote_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.SuperWheelspin}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/Super_Wheelspin_Prize.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Wheelspin}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/WheelSpin_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.BarnFindRumour}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/BarnFind_Shadow.png" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.SkillPoints}" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/PrizeIcons/SkillPoint_Shadow.png" />
    </local:MappingConverter>

    <local:FZMaterialPresetRoundtangle x:Key="A_Preset_FZMaterial_Gradient_HorizonEdition"
        BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"
        CornerRadius="{StaticResource A_CornerRadius_InnerInner_Top}"
        GradientColorA="{StaticResource A_Color_HorizonEditionGradientA}"
        GradientColorB="{StaticResource A_Color_HorizonEditionGradientB}"
        GradientAngle="90"/>

    <local:FZMaterialPresetRoundtangle x:Key="A_Preset_FZMaterial_Gradient_HorizonEdition_Desaturated"
        BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"
        CornerRadius="{StaticResource A_CornerRadius_InnerInner_Top}"
        GradientColorA="{StaticResource A_Color_HorizonEditionGradientA_Desaturated}"
        GradientColorB="{StaticResource A_Color_HorizonEditionGradientB_Desaturated}"
        GradientAngle="90"/>

    <local:MappingConverter x:Key="A_Converter_Index_To_GoldState" Default="{x:Null}">
        <local:MappingConverterEntry Key="0" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/Gold_Border_Prize_1.png" />
        <local:MappingConverterEntry Key="1" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/Gold_Border_Prize_2.png" />
        <local:MappingConverterEntry Key="2" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/Gold_Border_Prize_3.png" />
        <local:MappingConverterEntry Key="3" Value="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/Gold_Border_Prize_4.png" />
    </local:MappingConverter>

    <Style x:Key="A_Style_FZMaterial_FlatPanel_Tile_PreviewReward" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_FlatPanel_Tile}">
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerAll}"/>
    </Style>

    <local:MappingConverter x:Key="A_Converter_RewardTypeToUIColor" Default="False">
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.QuickChatPhrase}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.SuperWheelspin}" Value="True" />
        <local:MappingConverterEntry Key="{x:Static local:UIRewardType.Wheelspin}" Value="True" />
    </local:MappingConverter>

    <DataTemplate DataType="local:XAMLReward" x:Key="A_ControlTemplate_RewardPreview">
        <local:FZMaterial Width="178" Height="178" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,8,0"  Style="{StaticResource A_Style_FZMaterial_FlatPanel_Tile_PreviewReward}">
            <Grid>
                <Grid x:Name="Content" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="6">
                    <local:FZMaterial x:Name="RewardImageShadowBackground" ImageSource="/ForzaUI;component/Textures/Data_Bound/SeriesRewards/Gradient_BG.png"/>

                    <local:FZMaterial x:Name="PrizeRarityBackground" Visibility="Hidden" Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerInnerAll}"
                                        Color="{Binding Rarity, Converter={StaticResource A_Converter_RarityToColor}}" />
                    <local:FZMaterial x:Name="PrizeRarityDarkTint" Visibility="Hidden" Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerInnerAll}"
                                        Color="#FF000000" Opacity="0.2" />

                    <local:FZMaterial x:Name="RewardImage" Visibility="Visible" ImageSource="{Binding Thumbnail}" Margin="2,0,2,-42"
                                        Width="132" Height="132"
                                        VerticalAlignment="Center" HorizontalAlignment="Center"/>

                    <local:FZMaterial x:Name="RewardTypeImage" ImageSource="{Binding RewardType, Converter={StaticResource A_Converter_RewardTypeToSeriesRwardPrizeIcon}}"
                                            VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Color="{StaticResource A_Color_White}" Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerInnerAll}"
                                            Stretch="Uniform" Visibility="Hidden"/>

                    <local:FZMaterial x:Name="HeaderPanel" Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerInnerTopOnly}"
                                        VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="0,0,0.5,0"
                                        Height="38" Color="{Binding Rarity, Converter={StaticResource A_Converter_RarityToColor}}"/>
                </Grid>

                <local:FZMaterial x:Name="GoldAchievedPanel" ImageSource="{Binding Path=(local:TickerItemsControlItem.Index), Converter={StaticResource A_Converter_Index_To_GoldState}}"
                                    Visibility="Hidden" Margin="6" Stretch="Uniform"/>

                <local:AutoScrollPanel Style="{StaticResource A_Style_AutoScrollPanel_RewardPreviewTitle}" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="9,14"
                                        local:BindingProxy.A="{Binding Path=(local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}"/>
            </Grid>

        </local:FZMaterial>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding RewardType}" Value="{x:Static local:UIRewardType.Car}">
                <Setter TargetName="RewardImage" Property="ImageSource" Value="{Binding SmallThumbnail}"/>
                <Setter TargetName="RewardImage" Property="Height" Value="106"/>
                <Setter TargetName="RewardImage" Property="Margin" Value="2,0,2,-30"/>
                <Setter TargetName="RewardImage" Property="Width" Value="{Binding Height, RelativeSource={RelativeSource Self}, Converter={StaticResource A_Converter_CarThumb_Ratio}}"/>
            </DataTrigger>

            <DataTrigger Binding="{Binding RewardType,Converter={StaticResource A_Converter_Show_Reward_Icon}}" Value="True">
                <Setter TargetName="RewardTypeImage" Property="Visibility" Value="Visible"/>
                <Setter TargetName="PrizeRarityBackground" Property="Visibility" Value="Visible"/>
                <Setter TargetName="PrizeRarityDarkTint" Property="Visibility" Value="Visible"/>
                <Setter TargetName="RewardImageShadowBackground" Property="Visibility" Value="Hidden"/>
                <Setter TargetName="RewardImage" Property="Visibility" Value="Hidden"/>
            </DataTrigger>

            <!--Override image property for specific reward types -->
            <DataTrigger Binding="{Binding RewardType}" Value="{x:Static local:UIRewardType.SuperWheelspin}">
                <Setter TargetName="PrizeRarityBackground" Property="Visibility" Value="Hidden"/>
                <Setter TargetName="HeaderPanel" Property="Margin" Value="0,0,0,0"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding RewardType}" Value="{x:Static local:UIRewardType.Wheelspin}">
                <Setter TargetName="PrizeRarityBackground" Property="Visibility" Value="Hidden"/>
                <Setter TargetName="HeaderPanel" Property="Margin" Value="0,0,0,0"/>
            </DataTrigger>
                    
            <!--Override color for the rewards with no rarity-->
            <DataTrigger Binding="{Binding RewardType, Converter={StaticResource A_Converter_RewardTypeToUIColor}}" Value="True">
                <Setter TargetName="PrizeRarityBackground" Property="Color" Value="{StaticResource A_Color_Header_Background}"/>
                <Setter TargetName="HeaderPanel" Property="Color" Value="{StaticResource A_Color_Header_Background}"/>
            </DataTrigger>
                    
            <DataTrigger Binding="{Binding Rarity}" Value="{x:Static local:XAMLRarity.HorizonEdition}">
                <Setter TargetName="HeaderPanel" Property="Preset" Value="{StaticResource A_Preset_FZMaterial_Gradient_HorizonEdition}"/>
                <Setter TargetName="HeaderPanel" Property="Color" Value="#FFFFFFFF"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding DataContext.HasAchievedLeagueRank, RelativeSource={RelativeSource FindAncestor, AncestorType=local:TickerItemsControl}}" Value="True">
                <Setter TargetName="GoldAchievedPanel" Property="Visibility" Value="Visible"/>
                <Setter TargetName="HeaderPanel" Property="Visibility" Value="Hidden"/>

                <Setter TargetName="PrizeRarityBackground" Property="Margin" Value="2,1"/>
                <Setter TargetName="RewardTypeImage" Property="Margin" Value="2"/>
            </DataTrigger>
            
            <DataTrigger Binding="{Binding Path=(local:BindingProxy.A), RelativeSource={RelativeSource Self}}" Value="Grey">
                <Setter TargetName="PrizeRarityBackground" Property="Preset">
                    <Setter.Value>
                        <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerInnerAll}" Saturation="0"/>
                    </Setter.Value>
                </Setter>
                <Setter TargetName="RewardImage" Property="Preset">
                    <Setter.Value>
                        <local:FZMaterialPresetRoundtangle Saturation="0"/>
                    </Setter.Value>
                </Setter>
                <Setter TargetName="RewardTypeImage" Property="Preset">
                    <Setter.Value>
                        <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerInnerAll}" Saturation="0"/>
                    </Setter.Value>
                </Setter>
                <Setter TargetName="HeaderPanel" Property="Preset">
                    <Setter.Value>
                        <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerInnerTopOnly}" Saturation="0"/>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=(local:BindingProxy.A), RelativeSource={RelativeSource Self}}" Value="Gold">
                <Setter TargetName="GoldAchievedPanel" Property="Visibility" Value="Visible"/>
                <Setter TargetName="HeaderPanel" Property="Visibility" Value="Hidden"/>

                <Setter TargetName="PrizeRarityBackground" Property="Margin" Value="2,1"/>
                <Setter TargetName="RewardTypeImage" Property="Margin" Value="2"/>
            </DataTrigger>

            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Path=(local:BindingProxy.A), RelativeSource={RelativeSource Self}}" Value="Grey"/>
                    <Condition Binding="{Binding Rarity}" Value="{x:Static local:XAMLRarity.HorizonEdition}"/>
                </MultiDataTrigger.Conditions>
                <Setter TargetName="HeaderPanel" Property="Preset" Value="{StaticResource A_Preset_FZMaterial_Gradient_HorizonEdition_Desaturated}"/>
                <Setter TargetName="HeaderPanel" Property="Color" Value="#FFFFFFFF"/>
            </MultiDataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

</ResourceDictionary>