<?xml version="1.0" encoding="utf-8" ?>
<local:MomentPageBase
    x:Class="BiliCopilot.UI.Pages.MomentPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:comment="using:BiliCopilot.UI.Controls.Comment"
    xmlns:components="using:BiliCopilot.UI.ViewModels.Components"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:BiliCopilot.UI.Extensions"
    xmlns:local="using:BiliCopilot.UI.Pages"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:moment="using:BiliCopilot.UI.Controls.Moment"
    mc:Ignorable="d">

    <Page.Resources>
        <DataTemplate x:Key="VideoTemplate" x:DataType="components:VideoMomentSectionDetailViewModel">
            <moment:VideoMomentSectionDetailControl ViewModel="{x:Bind}" />
        </DataTemplate>
        <DataTemplate x:Key="ComprehensiveTemplate" x:DataType="components:ComprehensiveMomentSectionDetailViewModel">
            <moment:ComprehensiveMomentSectionDetailControl ViewModel="{x:Bind}" />
        </DataTemplate>
        <ext:MomentSectionTemplateSelector
            x:Key="Selector"
            ComprehensiveTemplate="{StaticResource ComprehensiveTemplate}"
            VideoTemplate="{StaticResource VideoTemplate}" />
    </Page.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="56" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Border
            Grid.Row="1"
            Height="1"
            HorizontalAlignment="Stretch"
            Background="{ThemeResource DividerStrokeColorDefaultBrush}" />
        <moment:MomentHeader VerticalAlignment="Center" />
        <ContentControl
            Grid.Row="2"
            Content="{x:Bind ViewModel.SelectedSection, Mode=OneWay}"
            ContentTemplateSelector="{StaticResource Selector}"
            Style="{StaticResource AppContentControlStyle}" />
        <comment:CommentOverlayPanel
            x:Name="CommentPanel"
            Grid.RowSpan="3"
            IsPanelOpened="{x:Bind ViewModel.IsCommentsOpened, Mode=TwoWay}"
            ViewModel="{x:Bind ViewModel.CommentModule, Mode=OneWay}" />
    </Grid>
</local:MomentPageBase>
