<Window x:Class="FasdDesktopUi.Pages.SearchPage.SearchPageView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:FasdDesktopUi.Pages.SearchPage"
        xmlns:buc="clr-namespace:FasdDesktopUi.Basics.UserControls"
        xmlns:suc="clr-namespace:FasdDesktopUi.Pages.SlimPage.UserControls"
        xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
        mc:Ignorable="d"
        PreviewKeyDown="Window_PreviewKeyDown"
        Title="SearchPageView"
        AllowsTransparency="True"
        WindowStyle="None"
        Background="Transparent"
        VerticalAlignment="Bottom"
        ResizeMode="NoResize"
        WindowState="Maximized"
        Topmost="True"
        ShowInTaskbar="False">

    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVisibility" />
        <vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
    </Window.Resources>

    <Border x:Name="MainBorder"
            x:FieldModifier="private"
            Background="#01000000"
            Padding="10 13 10 10"
            HorizontalAlignment="Right"
            VerticalAlignment="Bottom">
        <Grid VerticalAlignment="Bottom">

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <!--Grid Row 0: Close Button-->
            <Grid x:Name="WindowStateBarContainer"
                  x:FieldModifier="private"
                  Grid.Row="0"
                  MinHeight="26">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <suc:SlimPageWindowStateBar Visibility="{Binding ElementName=MainBorder, Path=IsMouseOver, Converter={StaticResource BoolToVisibility}}"
                                            Grid.Row="0"
                                            Margin="0 -13 0 9"
                                            ClickedClose="SlimPageWindowStateBar_ClickedClose" />
            </Grid>

            <!--Grid Row 1: TicketOverview-->
            <Grid Grid.Row="1"
                  x:Name="BodyStack_TicketOverview"
                  x:FieldModifier="private"
                  Background="#01000000"
                  Visibility="Collapsed"
                  Margin="0 -2 0 -1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Border x:Name="TicketOverviewBorder"
                        x:FieldModifier="private"
                        Grid.Row="0"
                        Padding="10"
                        Margin="0 0 0 12"
                        Width="{Binding ElementName=SearchBarUc, Path=ActualWidth}"
                        Background="{DynamicResource BackgroundColor.Menu.Categories}"
                        CornerRadius="10"
                        Visibility="Visible">
                    <buc:TicketOverview x:Name="TicketOverviewUc"
                                        x:FieldModifier="private" />
                </Border>

                <Border Grid.Row="0">
                    <CheckBox x:Name="FilterCheckbox"
                              Style="{DynamicResource ToggleSwitch}"
                              Margin="0 7 50 129"
                              VerticalAlignment="Top"
                              HorizontalAlignment="Right"
                              Cursor="Hand"
                              Visibility="Visible">
                    </CheckBox>
                </Border>

                <Border Grid.Row="0">
                    <Label x:Name="RoleLabel"
                           Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Role}"
                           Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
                           Margin="280 0 0 0"
                           VerticalAlignment="Top"
                           HorizontalAlignment="Left"
                           FontWeight="Bold"
                           Visibility="Visible" />
                </Border>

                <Border Grid.Row="0">
                    <Label x:Name="OwnTicketsLabel"
                           Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.MyTickets}"
                           Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
                           Margin="200 0 0 0"
                           VerticalAlignment="Top"
                           HorizontalAlignment="Left"
                           FontWeight="Bold"
                           Visibility="Visible" />
                </Border>

                <Border Grid.Row="0">
                    <StackPanel Orientation="Horizontal"
                                Margin="9 0 0 0"
                                VerticalAlignment="Top"
                                HorizontalAlignment="Left">
                        <Label x:Name="TicketOverviewLabel"
                               Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Header}"
                               Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
                               VerticalAlignment="Top"
                               HorizontalAlignment="Left"
                               FontWeight="Bold"
                               Visibility="Visible" />
                        <buc:Badge Margin="6 0 0 0"
                                   VerticalAlignment="Center"
                                   Text="Beta">
                            <buc:Badge.LayoutTransform>
                                <ScaleTransform ScaleX="0.85"
                                                ScaleY="0.85" />
                            </buc:Badge.LayoutTransform>
                        </buc:Badge>
                    </StackPanel>
                </Border>
            </Grid>

            <!--Grid Row 2 SearchResult + SearchHistory-->
            <Grid Grid.Row="2"
                  x:Name="BodyStack_SearchResults"
                  Background="#01000000"
                  Visibility="Collapsed"
                  Margin="0 -2 0 2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Border x:Name="SearchHistoryBorder"
                        x:FieldModifier="private"
                        Grid.Row="0"
                        Padding="10"
                        Margin="0 0 0 10"
                        Width="{Binding ElementName=SearchBarUc, Path=ActualWidth}"
                        Background="{DynamicResource BackgroundColor.Menu.Categories}"
                        CornerRadius="10"
                        VerticalAlignment="Bottom"
                        Visibility="Collapsed">
                    <buc:CustomSearchResultCollection x:Name="SearchHistory"
                                                      x:FieldModifier="private" />
                </Border>

                <Border x:Name="SearchResultBorder"
                        x:FieldModifier="private"
                        Grid.Row="1"
                        Padding="10"
                        Margin="0 -2 0 9"
                        Width="{Binding ElementName=SearchBarUc, Path=ActualWidth}"
                        Background="{DynamicResource BackgroundColor.Menu.Categories}"
                        CornerRadius="10"
                        VerticalAlignment="Bottom"
                        Visibility="Collapsed">
                    <ScrollViewer VerticalScrollBarVisibility="Auto">
                        <buc:CustomSearchResultCollection x:Name="ResultMenu"
                                                          x:FieldModifier="private"
                                                          PreviewMouseWheel="ResultMenu_PreviewMouseWheel" />
                    </ScrollViewer>
                </Border>
            </Grid>

            <!--Grid Row 3: SearchBar-->
            <Grid Grid.Row="3">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <buc:SearchBar x:Name="SearchBarUc"
                               x:FieldModifier="private"
                               Grid.Row="0"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Bottom"
                               Width="330" />
            </Grid>

        </Grid>
    </Border>

</Window>
