<?xml version="1.0" encoding="utf-8" ?>
<local:LiveChatSectionBase
    x:Class="BiliCopilot.UI.Controls.Player.LiveChatSection"
    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:components="using:BiliCopilot.UI.Controls.Components"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:BiliCopilot.UI.Extensions"
    xmlns:ic="using:FluentIcons.WinUI"
    xmlns:items="using:BiliCopilot.UI.ViewModels.Items"
    xmlns:local="using:BiliCopilot.UI.Controls.Player"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid RowSpacing="8">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <local:LiveInfoSection ViewModel="{x:Bind ViewModel.Page, Mode=OneWay}" />
        <base:EmptyHolder
            Grid.Row="1"
            Description="{ext:Locale Name=NoMessage}"
            Emoji="&#x1F526;"
            Visibility="{x:Bind ViewModel.IsEmpty, Mode=OneWay}" />
        <ItemsView
            x:Name="View"
            Grid.Row="1"
            Padding="12"
            VerticalAlignment="Top"
            ItemsSource="{x:Bind ViewModel.Messages, Mode=OneWay}"
            SelectionMode="None">
            <ItemsView.Layout>
                <StackLayout Spacing="12" />
            </ItemsView.Layout>
            <ItemsView.ItemTemplate>
                <DataTemplate x:DataType="items:LiveDanmakuItemViewModel">
                    <ItemContainer Style="{StaticResource AppItemContainerStyle}">
                        <components:LiveDanmakuItemControl ViewModel="{x:Bind}" />
                    </ItemContainer>
                </DataTemplate>
            </ItemsView.ItemTemplate>
        </ItemsView>
        <AutoSuggestBox
            Grid.Row="2"
            MaxHeight="80"
            Margin="12,0,12,8"
            HorizontalAlignment="Stretch"
            IsEnabled="{x:Bind ViewModel.IsSending, Mode=OneWay, Converter={StaticResource ObjectToBoolReverseConverter}}"
            PlaceholderText="{ext:Locale Name=DanmakuPlaceholder}"
            QuerySubmitted="OnDanmakuSubmitted">
            <AutoSuggestBox.TextBoxStyle>
                <Style BasedOn="{StaticResource AutoSuggestBoxTextBoxStyle}" TargetType="TextBox">
                    <Setter Property="TextWrapping" Value="Wrap" />
                    <Setter Property="Padding" Value="16,8" />
                </Style>
            </AutoSuggestBox.TextBoxStyle>
            <AutoSuggestBox.QueryIcon>
                <ic:SymbolIcon FontSize="12" Symbol="Send" />
            </AutoSuggestBox.QueryIcon>
        </AutoSuggestBox>
    </Grid>
</local:LiveChatSectionBase>
