<?xml version="1.0" encoding="utf-8" ?>
<local:ChatMessageControlBase
    x:Class="BiliCopilot.UI.Controls.Message.ChatSessionBody"
    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:items="using:BiliCopilot.UI.ViewModels.Items"
    xmlns:local="using:BiliCopilot.UI.Controls.Message"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <ScrollView x:Name="MessageView" Style="{StaticResource PageScrollViewStyle}">
            <ItemsControl
                MaxWidth="800"
                Margin="20,12,20,20"
                ItemsSource="{x:Bind ViewModel.Messages, Mode=OneWay}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <ItemsStackPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate x:DataType="items:ChatMessageItemViewModel">
                        <local:ChatMessageItemControl Margin="0,4" ViewModel="{x:Bind}" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollView>
        <base:EmptyHolder
            Description="{ext:Locale Name=NoMessage}"
            Emoji="&#x1F37B;"
            Visibility="{x:Bind ViewModel.IsEmpty}" />
        <base:LoadingWidget Text="{ext:Locale Name=LoadingAndWait}" Visibility="{x:Bind ViewModel.IsLoading, Mode=OneWay}" />
        <local:ChatMessageBox
            Grid.Row="1"
            MaxWidth="800"
            Margin="20,12"
            ViewModel="{x:Bind ViewModel, Mode=OneWay}" />
    </Grid>
</local:ChatMessageControlBase>
