<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=Noesis.GUI.Extensions"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:system="clr-namespace:System;assembly=mscorlib"
    xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <!-- NOTIFICATION CELEBRATION TEMPLATE -->
    <!--////////////////////////////////////////////////////////////////////-->
    <ControlTemplate x:Key="Template.NotificationCelebration" TargetType="ContentControl">
        <ControlTemplate.Resources>
            <Storyboard x:Key="Anim.NotificationCelebration.Show">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Decor" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" SpeedRatio="0.25" RepeatBehavior="Forever">
                    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="45"/>
                    <EasingDoubleKeyFrame KeyTime="00:00:02.0000000" Value="180"/>
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1.15"/>
                    <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="1">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1.15"/>
                    <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="1">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>

                <PointAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)">
                    <EasingPointKeyFrame KeyTime="00:00:00" Value="0.5,0.5"/>
                </PointAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.7"/>
                    <EasingDoubleKeyFrame KeyTime="00:00:00.7000000" Value="1">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.7"/>
                    <EasingDoubleKeyFrame KeyTime="00:00:00.7000000" Value="1">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="(UIElement.Opacity)">
                    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                    <EasingDoubleKeyFrame KeyTime="00:00:01.0000000" Value="1">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <PowerEase EasingMode="EaseOut" Power="2"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Decor" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.85"/>
                    <EasingDoubleKeyFrame KeyTime="00:00:00.6000000" Value="1">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Decor" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.85"/>
                    <EasingDoubleKeyFrame KeyTime="00:00:00.6000000" Value="1">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="Anim.NotificationCelebration.Hide">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="(UIElement.Opacity)">
                    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                    <EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </ControlTemplate.Resources>

        <Grid
            x:Name="Root"
            Width="1080"
            VerticalAlignment="Center"
            RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Grid.RenderTransform>

            <Border
                x:Name="Background"
                Height="136" RenderTransformOrigin="0.5,0.5">
                <Border.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Border.RenderTransform>

                <Border.Effect>
                    <BlurEffect Radius="12"/>
                </Border.Effect>

                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                        <GradientStop Color="#001A2737" Offset="0"/>
                        <GradientStop Color="#1A2737" Offset="0.2"/>
                        <GradientStop Color="#1A2737" Offset="0.8"/>
                        <GradientStop Color="#001A2737" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>
            </Border>

            <Border
                x:Name="Mask"
                Width="224"
                Height="224"
                VerticalAlignment="Center"
                HorizontalAlignment="Center">

                <Border.OpacityMask>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                        <GradientStop Offset="0.2"/>
                        <GradientStop Offset="0.8"/>
                        <GradientStop Offset="0.5" Color="#FFFFFFFF"/>
                    </LinearGradientBrush>
                </Border.OpacityMask>

                <Image
                    x:Name="Decor"
                    Source="/Root;component/Textures/Decorations/DecorCircular01.png"
                    RenderTransformOrigin="0.5,0.5">

                    <Image.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Image.RenderTransform>
                </Image>
            </Border>

            <!-- The ContentPresenter allows us to render content inside of the notification -->
            <ContentPresenter
                x:Name="Content"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                RenderTransformOrigin="0.5,0.5">

                <ContentPresenter.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </ContentPresenter.RenderTransform>
            </ContentPresenter>
        </Grid>

        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding Celebrations.Expired}" Value="False">
                <DataTrigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource Anim.NotificationCelebration.Show}"/>
                </DataTrigger.EnterActions>
            </DataTrigger>

            <DataTrigger Binding="{Binding Celebrations.Expired}" Value="True">
                <DataTrigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource Anim.NotificationCelebration.Hide}"/>
                </DataTrigger.EnterActions>
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- NOTIFICATION ITEM STYLE -->
    <!--////////////////////////////////////////////////////////////////////-->
    <Style x:Key="Style.NotificationCelebration" TargetType="ContentControl" BasedOn="{StaticResource {x:Type ContentControl}}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template" Value="{StaticResource Template.NotificationCelebration}" />
    </Style>

    <!-- NOTIFICATION ITEM DATA TEMPLATE -->
    <!--////////////////////////////////////////////////////////////////////-->
    <DataTemplate x:Key="Content.NotificationCelebration.LevelUp">
        <DataTemplate.Resources>
            <BooleanToVisibilityConverter x:Key="BoolToVisConverter"/>
        </DataTemplate.Resources>

        <StackPanel
            Background="Transparent"
            HorizontalAlignment="Center"
            VerticalAlignment="Center">

            <TextBlock
                x:Name="Subtitle"
                Text="{Binding Subtitle}"
                TextWrapping="Wrap"
                FontSize="{DynamicResource Font.Size.Body}"
                FontFamily="{DynamicResource Font.CoreSansBold}"
                Foreground="{DynamicResource Color.Text}"
                TextAlignment="Center"
                Margin="0,0,0,8"
                Visibility="{Binding HasSubtitle, Converter={StaticResource BoolToVisConverter}}"/>

            <TextBlock
                x:Name="Title"
                Text="{Binding Title}"
                TextWrapping="Wrap"
                FontSize="{DynamicResource Font.Size.Heading1}"
                FontFamily="{DynamicResource Font.LexendBold}"
                Foreground="{DynamicResource Color.TextSelected}"
                TextAlignment="Center"/>
          </StackPanel>
    </DataTemplate>
</ResourceDictionary>
