<?xml version="1.0" encoding="utf-8" ?>
<local:LiveCardPresenter
    x:Class="BiliCopilot.UI.Controls.Components.PartitionLivePresenter"
    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>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="106" />
        </Grid.RowDefinitions>
        <local:VideoCoverImage CornerRadius="4,4,0,0" Source="{x:Bind ViewModel.Cover, Mode=OneWay}" />

        <Grid
            Margin="6"
            HorizontalAlignment="Left"
            VerticalAlignment="Bottom">
            <Ellipse
                Width="35"
                Height="35"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Fill="Black"
                Opacity="0.7" />
            <PersonPicture
                Width="32"
                Height="32"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                DisplayName="{x:Bind ViewModel.Author, Mode=OneWay}"
                ProfilePicture="{x:Bind ViewModel.Avatar, Converter={StaticResource BitmapConverter}, Mode=OneWay}"
                ToolTipService.ToolTip="{x:Bind ViewModel.Author, Mode=OneWay}" />
        </Grid>

        <Grid
            Grid.Row="1"
            Padding="12,8,12,12"
            RowSpacing="6">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <base:TrimTextBlock
                VerticalAlignment="Center"
                FontSize="12"
                Foreground="{ThemeResource TextFillColorTertiaryBrush}"
                Text="{x:Bind ViewModel.Author, Mode=OneWay}" />

            <base:TrimTextBlock
                Grid.Row="1"
                HorizontalAlignment="Left"
                Text="{x:Bind ViewModel.Title, Mode=OneWay}" />

            <Grid Grid.Row="2" ColumnSpacing="8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <base:TrimTextBlock
                    VerticalAlignment="Center"
                    FontSize="12"
                    Foreground="{ThemeResource TextFillColorTertiaryBrush}"
                    MaxLines="1"
                    Text="{x:Bind ViewModel.Subtitle, Mode=OneWay}" />
                <StackPanel
                    Grid.Column="1"
                    VerticalAlignment="Center"
                    Orientation="Horizontal"
                    Spacing="4"
                    ToolTipService.ToolTip="{ext:Locale Name=Viewer}">
                    <ic:SymbolIcon
                        VerticalAlignment="Center"
                        FontSize="10"
                        Foreground="{ThemeResource AccentTextFillColorTertiaryBrush}"
                        Symbol="Eye" />
                    <TextBlock
                        VerticalAlignment="Center"
                        FontSize="10"
                        Foreground="{ThemeResource TextFillColorTertiaryBrush}"
                        Style="{StaticResource CaptionTextBlockStyle}"
                        Text="{x:Bind ViewModel.ViewerCount, Converter={StaticResource CountConverter}, Mode=OneWay}"
                        TextLineBounds="Tight" />
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</local:LiveCardPresenter>
