<?xml version="1.0" encoding="utf-8" ?>
<local:VideoPlayerPageControlBase
    x:Class="BiliCopilot.UI.Controls.Player.VideoDescriptorControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:app="using:Richasy.BiliKernel.Models.Base"
    xmlns:community="using:CommunityToolkit.WinUI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="using:BiliCopilot.UI.Controls.Player"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <StackPanel Spacing="8">
        <local:UpSectionControl
            Margin="-8,0,0,0"
            HorizontalAlignment="Left"
            ActiveCommand="{x:Bind ViewModel.OpenUserSpaceCommand, Mode=OneWay}"
            Avatar="{x:Bind ViewModel.UpAvatar, Mode=OneWay}"
            IsFollow="{x:Bind ViewModel.IsFollow, Mode=OneWay}"
            IsFollowButtonShown="{x:Bind ViewModel.IsMyVideo, Mode=OneWay, Converter={StaticResource ObjectToBoolReverseConverter}}"
            Subtitle="{x:Bind ViewModel.PublishRelativeTime, Mode=OneWay}"
            ToggleFollowCommand="{x:Bind ViewModel.ToggleFollowCommand, Mode=OneWay}"
            UserName="{x:Bind ViewModel.UpName, Mode=OneWay}" />
        <local:VideoStatControl Margin="8,0,0,8" ViewModel="{x:Bind ViewModel, Mode=OneWay}" />
        <ItemsRepeater x:Name="TagRepeater" ItemsSource="{x:Bind ViewModel.Tags, Mode=OneWay}">
            <ItemsRepeater.ItemTemplate>
                <DataTemplate x:DataType="app:BiliTag">
                    <Button
                        Padding="6,4"
                        AutomationProperties.Name="{x:Bind Name}"
                        Background="Transparent"
                        Click="OnTagButtonClick"
                        Content="{x:Bind Name}"
                        DataContext="{x:Bind}"
                        FontSize="11" />
                </DataTemplate>
            </ItemsRepeater.ItemTemplate>
            <ItemsRepeater.Layout>
                <community:WrapLayout HorizontalSpacing="8" VerticalSpacing="8" />
            </ItemsRepeater.Layout>
        </ItemsRepeater>
        <Grid
            Padding="12,8,12,0"
            Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
            CornerRadius="{StaticResource ControlCornerRadius}"
            Visibility="{x:Bind ViewModel.Description, Mode=OneWay, Converter={StaticResource ObjectToVisibilityConverter}}">
            <TextBlock
                IsTextSelectionEnabled="True"
                LineHeight="28"
                Text="{x:Bind ViewModel.Description, Mode=OneWay}"
                TextWrapping="Wrap" />
        </Grid>
    </StackPanel>
</local:VideoPlayerPageControlBase>
