<?xml version="1.0" encoding="utf-8" ?>
<local:MomentCardPresenter
    x:Class="BiliCopilot.UI.Controls.Components.VideoMomentPresenter"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:base="using:Richasy.WinUIKernel.Share.Base"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:BiliCopilot.UI.Extensions"
    xmlns:ic="using:FluentIcons.WinUI"
    xmlns:local="using:BiliCopilot.UI.Controls.Components"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Padding="12" RowSpacing="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid ColumnSpacing="12">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Button
                x:Name="UserButton"
                Command="{x:Bind ViewModel.ShowUserSpaceCommand, Mode=OneWay}"
                Style="{StaticResource AvatarButtonStyle}">
                <PersonPicture
                    Width="36"
                    Height="36"
                    VerticalAlignment="Center"
                    DisplayName="{x:Bind ViewModel.Author, Mode=OneWay}"
                    ProfilePicture="{x:Bind ViewModel.Avatar, Mode=OneWay, Converter={StaticResource BitmapConverter}}" />
            </Button>
            <StackPanel
                Grid.Column="1"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Spacing="2">
                <TextBlock
                    MaxLines="1"
                    Text="{x:Bind ViewModel.Author, Mode=OneWay}"
                    TextTrimming="CharacterEllipsis" />
                <TextBlock
                    Foreground="{ThemeResource TextFillColorTertiaryBrush}"
                    MaxLines="1"
                    Style="{StaticResource CaptionTextBlockStyle}"
                    Text="{x:Bind ViewModel.Tip, Mode=OneWay}"
                    TextTrimming="CharacterEllipsis" />
            </StackPanel>
            <Button
                Grid.Column="2"
                VerticalAlignment="Center"
                AutomationProperties.Name="{ext:Locale Name=Description}"
                Style="{StaticResource IconButtonStyle}"
                ToolTipService.ToolTip="{ext:Locale Name=Description}"
                Visibility="{x:Bind ViewModel.Description, Converter={StaticResource ObjectToVisibilityConverter}, Mode=OneWay}">
                <ic:SymbolIcon FontSize="12" Symbol="Feed" />
                <Button.Flyout>
                    <Flyout Placement="Bottom">
                        <local:EmoteTextBlock
                            MaxWidth="400"
                            MaxLines="99"
                            Text="{x:Bind ViewModel.Description, Mode=OneWay}" />
                    </Flyout>
                </Button.Flyout>
            </Button>
        </Grid>
        <local:VideoCoverImage
            Grid.Row="1"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch"
            CornerRadius="{StaticResource ControlCornerRadius}"
            DecodeHeight="280"
            DecodeWidth="380"
            Source="{x:Bind ViewModel.VideoCover, Mode=OneWay}" />
        <Border
            Grid.Row="1"
            Margin="4"
            Padding="4"
            HorizontalAlignment="Left"
            VerticalAlignment="Bottom"
            CornerRadius="{StaticResource ControlCornerRadius}">
            <Border.Background>
                <SolidColorBrush Opacity="0.6" Color="Black" />
            </Border.Background>
            <TextBlock
                Foreground="White"
                Style="{StaticResource CaptionTextBlockStyle}"
                Text="{x:Bind ViewModel.VideoDuration, Mode=OneWay}" />
        </Border>
        <base:TrimTextBlock
            Grid.Row="2"
            HorizontalAlignment="Left"
            FontSize="13"
            MaxLines="1"
            Text="{x:Bind ViewModel.VideoTitle, Mode=OneWay}" />
        <local:MomentItemOperationPanel Grid.Row="3" ViewModel="{x:Bind ViewModel, Mode=OneWay}" />
    </Grid>
</local:MomentCardPresenter>
