<?xml version="1.0" encoding="utf-8" ?>
<local:PromptTestSessionItemControlBase
    x:Class="RodelAgent.UI.Controls.Internal.PromptTestSessionItemControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:base="using:Richasy.WinUI.Share.Base"
    xmlns:controls="using:RodelAgent.UI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:RodelAgent.UI.Extensions"
    xmlns:local="using:RodelAgent.UI.Controls.Internal"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid
        Padding="12,8"
        Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
        CornerRadius="{StaticResource ControlCornerRadius}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <base:StatusTip Status="{x:Bind ViewModel.State, Mode=OneWay}" Text="{x:Bind ViewModel.Title, Mode=OneWay}">
            <ToolTipService.ToolTip>
                <ToolTip Content="{x:Bind ViewModel.Error, Mode=OneWay}" IsEnabled="{x:Bind ViewModel.Error, Mode=OneWay, Converter={StaticResource ObjectToBoolConverter}}" />
            </ToolTipService.ToolTip>
        </base:StatusTip>
        <base:TrimTextBlock
            Grid.Row="1"
            Margin="0,4,0,0"
            FontSize="12"
            Foreground="{ThemeResource TextFillColorSecondaryBrush}"
            MaxLines="2"
            Text="{x:Bind ViewModel.Input, Mode=OneWay}" />
        <HyperlinkButton
            Grid.Row="2"
            Margin="0,8,0,0"
            Padding="4,2"
            HorizontalAlignment="Left"
            Click="OnResultButtonClick"
            Content="{ext:Locale Name=CheckResult}"
            FontSize="12"
            Visibility="{x:Bind ViewModel.Result, Mode=OneWay, Converter={StaticResource ObjectToVisibilityConverter}}">
            <FlyoutBase.AttachedFlyout>
                <Flyout>
                    <Grid Width="400" ColumnSpacing="12">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <TextBlock
                            HorizontalAlignment="Left"
                            VerticalAlignment="Top"
                            IsTextSelectionEnabled="True"
                            Text="{x:Bind ViewModel.Input, Mode=OneWay}"
                            TextWrapping="Wrap" />
                        <Border
                            Grid.Column="1"
                            Width="1"
                            VerticalAlignment="Stretch"
                            Background="{ThemeResource DividerStrokeColorDefaultBrush}" />
                        <TextBlock
                            Grid.Column="2"
                            VerticalAlignment="Top"
                            IsTextSelectionEnabled="True"
                            LineHeight="22"
                            Text="{x:Bind ViewModel.Result, Mode=OneWay}"
                            TextWrapping="Wrap" />
                    </Grid>
                </Flyout>
            </FlyoutBase.AttachedFlyout>
        </HyperlinkButton>
    </Grid>
</local:PromptTestSessionItemControlBase>
