<UserControl x:Class="FasdDesktopUi.Pages.DetailsPage.UserControls.DetailsPageNavigationHeading"
             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:FasdDesktopUi.Pages.DetailsPage.UserControls"
             xmlns:buc="clr-namespace:FasdDesktopUi.Basics.UserControls"
             xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
             xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
             x:Name="NavigationHeadingUc"
             mc:Ignorable="d">
    <UserControl.Resources>
        <vc:NullValueToVisibilityConverter x:Key="NullToVisibility" />
        <BooleanToVisibilityConverter x:Key="BoolToVisibility" />

        <Style TargetType="ico:AdaptableIcon"
               BasedOn="{StaticResource DetailsPage.TitleSection.Icon}">
            <Setter Property="Cursor"
                    Value="Hand" />
            <EventSetter Event="MouseLeftButtonUp"
                         Handler="HeadingIcon_MouseLeftButtonUp" />
            <EventSetter Event="TouchDown"
                         Handler="HeadingIcon_TouchDown" />
        </Style>

        <Style x:Key="DetailsPage.TitleSection.Border.NotSelected"
               TargetType="Border"
               BasedOn="{StaticResource DetailsPage.TitleSection.Border.NotSelected}">
            <EventSetter Event="MouseLeftButtonUp"
                         Handler="HeadingIcon_MouseLeftButtonUp" />
            <EventSetter Event="TouchDown"
                         Handler="HeadingIcon_TouchDown" />
        </Style>

        <Style x:Key="SwapIconStyleBase"
               x:Name="SwapIconStyleBase"
               TargetType="ico:AdaptableIcon"
               BasedOn="{StaticResource Menu.MenuBar.PinnedIcon.Base}">
            <Setter Property="Visibility"
                    Value="Hidden" />
            <Setter Property="Opacity"
                    Value="0.7" />
            <Setter Property="Cursor"
                    Value="{x:Null}" />
            <Setter Property="SelectedInternIcon"
                    Value="misc_chevron_down" />
            <Setter Property="IconWidth"
                    Value="40" />
            <Setter Property="IconHeight"
                    Value="42" />
            <Setter Property="BorderPadding"
                    Value="10 0 10 0" />
            <Setter Property="BorderThickness"
                    Value="3 0 0 0" />
            <Setter Property="Margin"
                    Value="0" />
            <Setter Property="IconCornerRadius"
                    Value="10" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Border}, Path=IsMouseOver}"
                             Value="True">
                    <Setter Property="Visibility"
                            Value="Visible" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="SwapIconStyle"
               TargetType="ico:AdaptableIcon"
               BasedOn="{StaticResource SwapIconStyleBase}">
            <Setter Property="Opacity"
                    Value="1" />
            <Setter Property="Cursor"
                    Value="Hand" />
            <Setter Property="IconBackgroundColor"
                    Value="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}" />

            <EventSetter Event="MouseLeftButtonUp"
                         Handler="SwapIcon_MouseLeftButtonUp" />
            <EventSetter Event="TouchDown"
                         Handler="SwapIcon_TouchDown" />

            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Border}, Path=IsMouseOver}"
                             Value="True">
                    <Setter Property="IconBackgroundColor"
                            Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
                </DataTrigger>

                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsMouseOver}"
                             Value="True">
                    <Setter Property="PrimaryIconColor"
                            Value="{DynamicResource Color.Menu.Icon.Hover}" />
                    <Setter Property="IconBackgroundColor"
                            Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
                </DataTrigger>
            </Style.Triggers>

        </Style>

        <Style TargetType="TextBlock"
               BasedOn="{StaticResource DetailsPage.TitleSection.Header}">
            <EventSetter Event="MouseLeftButtonUp"
                         Handler="HeadingIcon_MouseLeftButtonUp" />
            <EventSetter Event="TouchDown"
                         Handler="HeadingIcon_TouchDown" />
        </Style>

    </UserControl.Resources>

    <Border x:Name="HeadingBorder"
            MouseLeftButtonUp="HeadingBorder_Clicked"
            TouchDown="HeadingBorder_Clicked">
        <ScrollViewer x:Name="HeadingScroller"
                      x:FieldModifier="private"
                      HorizontalScrollBarVisibility="Auto"
                      VerticalScrollBarVisibility="Hidden"
                      Padding="0 7.5">
            <Grid>

                <Grid.RowDefinitions>
                    <RowDefinition Height="42" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Border Grid.Row="0"
                        Grid.Column="0"
                        Margin="0 0 10 0"
                        Background="#01000000"
                        Padding="5 0">
                    <StackPanel x:Name="UserStack"
                                Orientation="Horizontal">

                        <Border x:Name="UserStackHighlightBorder"
                                Style="{DynamicResource DetailsPage.TitleSection.Border.NotSelected}">
                            <StackPanel Orientation="Horizontal">
                                <ico:AdaptableIcon x:Name="UserIcon"
                                                   SelectedInternIcon="misc_user" />
                                <TextBlock x:Name="UserTextBlock" />
                            </StackPanel>
                        </Border>

                        <ico:AdaptableIcon x:Name="UserCopyIcon"
                                           Style="{DynamicResource SwapIconStyle}"
                                           MouseLeftButtonUp="CopyIcon_MouseLeftButtonUp"
                                           TouchDown="CopyIcon_TouchDown"
                                           SelectedInternIcon="menuBar_copy" />
                    </StackPanel>
                </Border>

                <Border Grid.Row="0"
                        Grid.Column="1"
                        Margin="10 0"
                        Background="#01000000"
                        Padding="5 0">
                    <StackPanel x:Name="ComputerStack"
                                Orientation="Horizontal">
                        <Border x:Name="ComputerStackHighlightBorder"
                                Style="{DynamicResource DetailsPage.TitleSection.Border.NotSelected}">
                            <StackPanel Orientation="Horizontal">
                                <ico:AdaptableIcon x:Name="ComputerIcon"
                                                   SecondaryIconColor="{DynamicResource Color.FunctionMarker}"
                                                   SelectedInternIcon="misc_computer"
                                                   Margin="10 0 7.5 0" />
                                <TextBlock x:Name="ComputerTextBlock" />

                                <ico:AdaptableIcon x:Name="ComputerSwapIcon"
                                                   Style="{DynamicResource SwapIconStyle}"
                                                   Visibility="Visible"
                                                   BorderBrush="{DynamicResource Color.SoftContrast}" />
                            </StackPanel>
                        </Border>

                        <ico:AdaptableIcon x:Name="ComputerCopyIcon"
                                           Style="{DynamicResource SwapIconStyle}"
                                           MouseLeftButtonUp="CopyIcon_MouseLeftButtonUp"
                                           TouchDown="CopyIcon_TouchDown"
                                           SelectedInternIcon="menuBar_copy" />
                    </StackPanel>
                </Border>
                <Border Background="{DynamicResource BackgroundColor.Menu.Categories}"
                        Padding="10"
                        Margin="10"
                        CornerRadius="10"
                        Visibility="{Binding ElementName=ComputerSelector, Path=MenuDataList, Converter={StaticResource NullToVisibility}}"
                        Grid.Row="1"
                        Grid.Column="1"
                        Grid.ColumnSpan="999"
                        MaxWidth="325"
                        HorizontalAlignment="Left">
                    <buc:CustomMenu x:Name="ComputerSelector"
                                    Grid.Row="1"
                                    Grid.Column="1"
                                    Grid.ColumnSpan="999"
                                    HorizontalAlignment="Left"
                                    MaxWidth="325" />
                </Border>

                <Border Grid.Row="0"
                        Grid.Column="2"
                        Margin="10 0"
                        Background="#01000000"
                        Padding="5 0"
                        x:Name="VirtualSessionBorder">
                    <StackPanel x:Name="VirtualSessionStack"
                                Orientation="Horizontal">
                        <Border x:Name="VirtualSessionStackHighlightBorder"
                                Style="{DynamicResource DetailsPage.TitleSection.Border.NotSelected}">
                            <StackPanel Orientation="Horizontal">
                                <ico:AdaptableIcon x:Name="VirtualSessionIcon"
                                                   SecondaryIconColor="{DynamicResource Color.FunctionMarker}"
                                                   SelectedInternIcon="misc_computer"
                                                   Margin="10 0 7.5 0" />
                                <TextBlock x:Name="VirtualSessionTextBlock" />

                                <ico:AdaptableIcon x:Name="VirtualSessionSwapIcon"
                                                   Style="{DynamicResource SwapIconStyle}"
                                                   Visibility="Visible"
                                                   BorderBrush="{DynamicResource Color.SoftContrast}" />
                            </StackPanel>
                        </Border>

                        <ico:AdaptableIcon x:Name="VirtualSessionCopyIcon"
                                           Style="{DynamicResource SwapIconStyle}"
                                           MouseLeftButtonUp="CopyIcon_MouseLeftButtonUp"
                                           TouchDown="CopyIcon_TouchDown"
                                           SelectedInternIcon="menuBar_copy" />
                    </StackPanel>
                </Border>
                <Border Background="{DynamicResource BackgroundColor.Menu.Categories}"
                        Padding="10"
                        Margin="10"
                        CornerRadius="10"
                        Visibility="{Binding ElementName=VirtualSessionSelector, Path=MenuDataList, Converter={StaticResource NullToVisibility}}"
                        Grid.Row="1"
                        Grid.Column="2"
                        Grid.ColumnSpan="999"
                        MaxWidth="325"
                        HorizontalAlignment="Left">
                    <buc:CustomMenu x:Name="VirtualSessionSelector"
                                    Grid.Row="1"
                                    Grid.Column="1"
                                    Grid.ColumnSpan="999"
                                    HorizontalAlignment="Left"
                                    MaxWidth="325" />
                </Border>

                <Border Grid.Row="0"
                        Grid.Column="3"
                        Margin="10 0"
                        Background="#01000000"
                        Padding="5 0"
                        x:Name="MobileDeviceBorder">
                    <StackPanel x:Name="MobileDeviceStack"
                                Orientation="Horizontal">
                        <Border x:Name="MobileDeviceStackHighlightBorder"
                                Style="{DynamicResource DetailsPage.TitleSection.Border.NotSelected}">
                            <StackPanel Orientation="Horizontal">
                                <ico:AdaptableIcon x:Name="MobileDeviceIcon"
                                                   SecondaryIconColor="{DynamicResource Color.FunctionMarker}"
                                                   SelectedMaterialIcon="ic_smartphone"
                                                   Margin="10 0 7.5 0" />
                                <TextBlock x:Name="MobileDeviceTextBlock" />

                                <ico:AdaptableIcon x:Name="MobileDeviceSwapIcon"
                                                   Style="{DynamicResource SwapIconStyle}"
                                                   Visibility="Visible"
                                                   BorderBrush="{DynamicResource Color.SoftContrast}" />
                            </StackPanel>
                        </Border>

                        <ico:AdaptableIcon x:Name="MobileDeviceCopyIcon"
                                           Style="{DynamicResource SwapIconStyle}"
                                           MouseLeftButtonUp="CopyIcon_MouseLeftButtonUp"
                                           TouchDown="CopyIcon_TouchDown"
                                           SelectedInternIcon="menuBar_copy" />
                    </StackPanel>
                </Border>
                <Border Background="{DynamicResource BackgroundColor.Menu.Categories}"
                        Padding="10"
                        Margin="10"
                        CornerRadius="10"
                        Visibility="{Binding ElementName=MobileDeviceSelector, Path=MenuDataList, Converter={StaticResource NullToVisibility}}"
                        Grid.Row="1"
                        Grid.Column="3"
                        Grid.ColumnSpan="999"
                        MaxWidth="325"
                        HorizontalAlignment="Left">
                    <buc:CustomMenu x:Name="MobileDeviceSelector"
                                    Grid.Row="1"
                                    Grid.Column="1"
                                    Grid.ColumnSpan="999"
                                    HorizontalAlignment="Left"
                                    MaxWidth="325" />
                </Border>
                <Border Grid.Row="0"
                        Grid.Column="4"
                        Margin="10 0"
                        Background="#01000000"
                        Padding="5 0"
                        x:Name="TicketBorder">
                    <StackPanel x:Name="TicketStack"
                                Orientation="Horizontal">
                        <Border x:Name="TicketStackHighlightBorder"
                                Style="{DynamicResource DetailsPage.TitleSection.Border.NotSelected}">
                            <StackPanel Orientation="Horizontal">
                                <ico:AdaptableIcon x:Name="TicketIcon"
                                                   IconHeight="25"
                                                   IconWidth="25"
                                                   SelectedMaterialIcon="ic_mail"
                                                   Margin="10 0 7.5 0" />
                                <TextBlock x:Name="TicketTextBlock" />

                                <ico:AdaptableIcon x:Name="TicketSwapIcon"
                                                   Style="{DynamicResource SwapIconStyle}"
                                                   Visibility="Visible"
                                                   BorderBrush="{DynamicResource Color.SoftContrast}" />
                            </StackPanel>
                        </Border>

                        <ico:AdaptableIcon x:Name="TicketCopyIcon"
                                           Style="{DynamicResource SwapIconStyle}"
                                           MouseLeftButtonUp="CopyIcon_MouseLeftButtonUp"
                                           TouchDown="CopyIcon_TouchDown"
                                           SelectedInternIcon="menuBar_copy" />

                        <ico:AdaptableIcon x:Name="EditTicketIcon"
                                           Style="{DynamicResource SwapIconStyle}"
                                           SelectedMaterialIcon="ic_edit"
                                           MouseLeftButtonUp="EditTicketIcon_MouseLeftButtonUp"
                                           TouchDown="EditTicketIcon_TouchDown" />

                        <ico:AdaptableIcon x:Name="SaveTicketIcon"
                                           Style="{DynamicResource SwapIconStyle}"
                                           SelectedMaterialIcon="ic_save"
                                           Visibility="Collapsed"
                                           MouseLeftButtonUp="SaveTicketIcon_MouseLeftButtonUp"
                                           TouchDown="SaveTicketIcon_TouchDown" />

                        <ico:AdaptableIcon x:Name="UndoTicketIcon"
                                           Style="{DynamicResource SwapIconStyle}"
                                           SelectedMaterialIcon="ic_undo"
                                           Visibility="Collapsed"
                                           MouseLeftButtonUp="UndoTicketIcon_MouseLeftButtonUp"
                                           TouchDown="UndoTicketIcon_TouchDown" />

                    </StackPanel>
                </Border>
                <Border Background="{DynamicResource BackgroundColor.Menu.Categories}"
                        Padding="10"
                        Margin="10"
                        CornerRadius="10"
                        Visibility="{Binding ElementName=TicketSelector, Path=MenuDataList, Converter={StaticResource NullToVisibility}}"
                        Grid.Row="1"
                        Grid.Column="4"
                        Grid.ColumnSpan="999"
                        MaxWidth="325"
                        HorizontalAlignment="Left">
                    <buc:CustomMenu x:Name="TicketSelector"
                                    x:FieldModifier="private"
                                    Grid.Row="1"
                                    Grid.Column="2"
                                    Grid.ColumnSpan="999"
                                    HorizontalAlignment="Left"
                                    MaxWidth="325" />
                </Border>

            </Grid>
        </ScrollViewer>
    </Border>
</UserControl>
