<local:CenterPopup
    x:Class="Bili.App.Controls.PgcSeasonDetailView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:account="using:Bili.ViewModels.Interfaces.Account"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:loc="using:Bili.App.Resources.Extension"
    xmlns:local="using:Bili.App.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    Title="{loc:Locale Name=Detail}"
    d:DesignHeight="300"
    d:DesignWidth="400"
    mc:Ignorable="d">

    <Grid RowSpacing="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid ColumnSpacing="12">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid CornerRadius="{StaticResource ControlCornerRadius}">
                <Image Width="120" Source="{x:Bind ViewModel.View.Information.Identifier.Cover.Uri, Mode=OneWay}" />
            </Grid>
            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock
                    Style="{StaticResource SubtitleTextBlockStyle}"
                    FontWeight="Bold"
                    Text="{x:Bind ViewModel.View.Information.Identifier.Title, Mode=OneWay}" />
                <Grid Grid.Row="1" ColumnSpacing="12">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Spacing="4">
                        <Border
                            Margin="0,0,8,0"
                            Padding="4,2"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            BorderBrush="{ThemeResource AccentFillColorDefaultBrush}"
                            BorderThickness="1"
                            CornerRadius="2"
                            Visibility="{x:Bind ViewModel.View.Information.HighlightTitle, Converter={StaticResource ObjectToVisibilityConverter}, Mode=OneWay}">
                            <TextBlock
                                FontSize="12"
                                Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
                                Text="{x:Bind ViewModel.View.Information.HighlightTitle, Mode=OneWay}" />
                        </Border>
                        <TextBlock
                            HorizontalAlignment="Left"
                            FontSize="12"
                            Text="{x:Bind ViewModel.View.Information.Tags, Mode=OneWay}"
                            TextWrapping="Wrap" />
                    </StackPanel>
                    <StackPanel
                        Grid.Column="1"
                        VerticalAlignment="Bottom"
                        Spacing="4"
                        Visibility="{x:Bind ViewModel.RatingCountText, Converter={StaticResource ObjectToVisibilityConverter}, Mode=OneWay}">
                        <TextBlock
                            HorizontalAlignment="Left"
                            FontSize="36"
                            FontWeight="Bold"
                            Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
                            Text="{x:Bind ViewModel.View.Information.CommunityInformation.Score, Mode=OneWay}" />
                        <TextBlock
                            HorizontalAlignment="Left"
                            FontSize="10"
                            Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                            Text="{x:Bind ViewModel.RatingCountText, Mode=OneWay}" />
                    </StackPanel>
                </Grid>
            </Grid>
        </Grid>
        <ScrollViewer
            Grid.Row="1"
            HorizontalScrollMode="Disabled"
            VerticalScrollBarVisibility="Hidden">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <StackPanel Spacing="8">
                    <Grid ColumnSpacing="12" Visibility="{x:Bind ViewModel.View.Information.OriginName, Converter={StaticResource ObjectToVisibilityConverter}, Mode=OneWay}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock
                            FontSize="12"
                            FontWeight="Bold"
                            Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                            Text="{loc:Locale Name=OriginName}" />
                        <TextBlock
                            Grid.Column="1"
                            FontSize="12"
                            IsTextSelectionEnabled="True"
                            Text="{x:Bind ViewModel.View.Information.OriginName, Mode=OneWay}"
                            TextWrapping="Wrap" />
                    </Grid>
                    <Grid ColumnSpacing="12" Visibility="{x:Bind ViewModel.View.Information.Alias, Converter={StaticResource ObjectToVisibilityConverter}, Mode=OneWay}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock
                            FontSize="12"
                            FontWeight="Bold"
                            Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                            Text="{loc:Locale Name=Alias}" />
                        <TextBlock
                            Grid.Column="1"
                            FontSize="12"
                            IsTextSelectionEnabled="True"
                            Text="{x:Bind ViewModel.View.Information.Alias, Mode=OneWay}"
                            TextWrapping="Wrap" />
                    </Grid>
                </StackPanel>
                <StackPanel
                    Grid.Row="1"
                    Margin="0,20,0,0"
                    Spacing="4"
                    Visibility="{x:Bind ViewModel.IsShowCelebrities, Mode=OneWay}">
                    <TextBlock
                        FontSize="12"
                        FontWeight="Bold"
                        Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                        Text="{loc:Locale Name=CastAndCrew}" />
                    <ScrollViewer
                        HorizontalScrollBarVisibility="Hidden"
                        HorizontalScrollMode="Enabled"
                        VerticalScrollMode="Disabled">
                        <muxc:ItemsRepeater ItemsSource="{x:Bind ViewModel.Celebrities, Mode=OneWay}">
                            <muxc:ItemsRepeater.Layout>
                                <muxc:StackLayout Orientation="Horizontal" Spacing="4" />
                            </muxc:ItemsRepeater.Layout>
                            <muxc:ItemsRepeater.ItemTemplate>
                                <DataTemplate x:DataType="account:IUserItemViewModel">
                                    <local:CardPanel
                                        AutomationProperties.Name="{x:Bind User.Name}"
                                        IsEnableHoverAnimation="False"
                                        ToolTipService.ToolTip="{x:Bind User.Name}">
                                        <Grid Padding="12">
                                            <StackPanel Spacing="4">
                                                <muxc:PersonPicture
                                                    Width="64"
                                                    Height="64"
                                                    Margin="0,0,0,8"
                                                    DisplayName="{x:Bind User.Name}"
                                                    ProfilePicture="{x:Bind User.Avatar.Uri}" />
                                                <TextBlock
                                                    MaxWidth="120"
                                                    HorizontalAlignment="Center"
                                                    FontSize="12"
                                                    Text="{x:Bind User.Name}"
                                                    TextTrimming="CharacterEllipsis" />
                                                <TextBlock
                                                    MaxWidth="120"
                                                    HorizontalAlignment="Center"
                                                    FontSize="12"
                                                    Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                                                    Text="{x:Bind Role}"
                                                    TextTrimming="CharacterEllipsis" />
                                            </StackPanel>
                                        </Grid>
                                    </local:CardPanel>
                                </DataTemplate>
                            </muxc:ItemsRepeater.ItemTemplate>
                        </muxc:ItemsRepeater>
                    </ScrollViewer>
                </StackPanel>

                <muxc:ItemsRepeater
                    Grid.Row="2"
                    Margin="0,12,0,0"
                    ItemsSource="{x:Bind ViewModel.View.Information.LaborSections}">
                    <muxc:ItemsRepeater.Layout>
                        <muxc:StackLayout Spacing="8" />
                    </muxc:ItemsRepeater.Layout>
                    <muxc:ItemsRepeater.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Grid.Row="2" Spacing="8">
                                <TextBlock
                                    FontSize="12"
                                    FontWeight="Bold"
                                    Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                                    Text="{Binding Key}" />
                                <TextBlock
                                    FontSize="12"
                                    IsTextSelectionEnabled="True"
                                    LineHeight="20"
                                    Text="{Binding Value, Mode=OneWay}"
                                    TextWrapping="Wrap" />
                            </StackPanel>
                        </DataTemplate>
                    </muxc:ItemsRepeater.ItemTemplate>
                </muxc:ItemsRepeater>

                <StackPanel
                    Grid.Row="3"
                    Margin="0,12,0,0"
                    Spacing="4">
                    <TextBlock
                        FontSize="12"
                        FontWeight="Bold"
                        Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                        Text="{loc:Locale Name=Description}" />
                    <TextBlock
                        FontSize="12"
                        IsTextSelectionEnabled="True"
                        LineHeight="20"
                        Text="{x:Bind ViewModel.View.Information.Description, Mode=OneWay}"
                        TextWrapping="Wrap" />
                </StackPanel>
            </Grid>
        </ScrollViewer>
    </Grid>
</local:CenterPopup>
