<ContentDialog
    x:Class="JumpPoint.Uwp.Dialogs.AppLinkLaunchResultsDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:JumpPoint.Uwp.Dialogs"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:winui="using:Microsoft.UI.Xaml.Controls"
               xmlns:items="using:JumpPoint.Platform.Items"
               mc:Ignorable="d"
    Title="App Link Launch Results"
    PrimaryButtonText="Close"
    DefaultButton="Primary">

    <ContentDialog.Resources>
        <Style TargetType="local:AppLinkLaunchResultsDialog"
               BasedOn="{StaticResource DefaultContentDialogStyle}" />
    </ContentDialog.Resources>

    <ScrollViewer>
        <StackPanel Spacing="8">
            <TextBlock Margin="0,0,0,8"
                       Style="{StaticResource TitleTextBlockStyle}"
                       Text="{x:Bind ViewModel.AppLink.Name, Mode=OneWay}" />

            <Grid ColumnSpacing="8"
                  Margin="0,0,0,8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Border Width="48"
                        Height="48"
                        Background="{x:Bind ViewModel.AppLink.Background, Mode=OneWay, Converter={StaticResource DrawingColorBrushConverter}}">
                    <Image Source="{x:Bind ViewModel.AppLink.Logo, Converter={StaticResource AppLinkGridTilesLogoConverter}, Mode=OneWay}"
                           Width="48"
                           Height="48" />
                </Border>
                <StackPanel Grid.Column="1">
                    <TextBlock Text="{x:Bind ViewModel.AppLink.Link, Mode=OneWay}"
                               Style="{StaticResource SubtitleTextBlockStyle}"
                               TextWrapping="Wrap" />
                    <TextBlock Text="{x:Bind ViewModel.AppLink.Description, Mode=OneWay, Converter={StaticResource StringEmptyConverter}, ConverterParameter='No description'}"
                               Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
                               TextWrapping="WrapWholeWords" />
                </StackPanel>
            </Grid>

            <TextBlock Text="{x:Bind ViewModel.AppLink.AppName, Mode=OneWay}"
                       FontWeight="SemiBold" />
            <TextBlock Text="{x:Bind ViewModel.AppLink.AppId, Mode=OneWay}"
                       Margin="0,0,0,8" />

            <TextBlock Text="QUERY:"
                       FontWeight="SemiBold"
                       VerticalAlignment="Center" />
            <winui:ItemsRepeater ItemsSource="{x:Bind ViewModel.AppLink.Query, Mode=OneWay}">
                <DataTemplate x:DataType="items:ValueInfo">
                    <StackPanel>
                        <TextBlock FontWeight="SemiBold"
                                   Text="{x:Bind Key}" />
                        <TextBlock Text="{x:Bind Value, Mode=OneWay}" />
                    </StackPanel>
                </DataTemplate>
            </winui:ItemsRepeater>

            <TextBlock Text="INPUT DATA:"
                       FontWeight="SemiBold"
                       VerticalAlignment="Center" />
            <winui:ItemsRepeater ItemsSource="{x:Bind ViewModel.AppLink.InputData, Mode=OneWay}">
                <DataTemplate x:DataType="items:ValueInfo">
                    <StackPanel>
                        <TextBlock FontWeight="SemiBold"
                                   Text="{x:Bind Key}" />
                        <TextBlock Text="{x:Bind Value, Mode=OneWay}" />
                    </StackPanel>
                </DataTemplate>
            </winui:ItemsRepeater>

            <TextBlock Text="RESULTS:"
                       FontWeight="SemiBold"
                       VerticalAlignment="Center" />
            <winui:ItemsRepeater ItemsSource="{x:Bind ViewModel.Results, Mode=OneWay}">
                <DataTemplate x:DataType="items:ValueInfo">
                    <StackPanel>
                        <TextBlock FontWeight="SemiBold"
                                   Text="{x:Bind Key}" />
                        <TextBlock Text="{x:Bind Value, Mode=OneWay}" />
                    </StackPanel>
                </DataTemplate>
            </winui:ItemsRepeater>
        </StackPanel>
    </ScrollViewer>
</ContentDialog>
