<?xml version="1.0" encoding="utf-8" ?>
<local:PlayerControlBase
    x:Class="BiliCopilot.UI.Controls.Core.ExternalTransportControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:BiliCopilot.UI.Extensions"
    xmlns:ic="using:FluentIcons.WinUI"
    xmlns:local="using:BiliCopilot.UI.Controls.Core"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid
        Margin="12,0"
        Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
        CornerRadius="{StaticResource ControlCornerRadius}">
        <Grid Padding="12,8">
            <Grid ColumnSpacing="8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid>
                    <ProgressRing
                        Width="38"
                        Height="38"
                        VerticalAlignment="Center"
                        IsActive="{x:Bind ViewModel.IsBuffering, Mode=OneWay}"
                        Visibility="{x:Bind ViewModel.IsBuffering, Mode=OneWay}" />
                    <Grid
                        Width="36"
                        Height="36"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
                        BorderThickness="2"
                        CornerRadius="18">
                        <Grid>
                            <ic:SymbolIcon
                                FontSize="14"
                                IconVariant="Filled"
                                Symbol="Play"
                                Visibility="{x:Bind ViewModel.IsPaused, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}" />
                            <ic:SymbolIcon
                                FontSize="14"
                                IconVariant="Filled"
                                Symbol="Pause"
                                Visibility="{x:Bind ViewModel.IsPaused, Converter={StaticResource BoolToVisibilityReverseConverter}, Mode=OneWay}" />
                        </Grid>
                    </Grid>
                </Grid>

                <ContentControl
                    x:Name="LeftPanel"
                    Grid.Column="1"
                    Content="{x:Bind LeftContent, Mode=OneWay}"
                    Style="{StaticResource AppContentControlStyle}" />
                <TextBlock
                    Grid.Column="2"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center">
                    <Run FontWeight="Bold" Text="{x:Bind ViewModel.Position, Converter={StaticResource DurationConverter}, Mode=OneWay}" />
                    <Run Text="/" />
                    <Run Text="{x:Bind ViewModel.Duration, Converter={StaticResource DurationConverter}, Mode=OneWay}" />
                </TextBlock>
                <Button
                    Grid.Column="3"
                    VerticalAlignment="Center"
                    Command="{x:Bind ViewModel.ReloadCommand, Mode=OneWay}"
                    Style="{StaticResource CircleIconButtonStyle}"
                    ToolTipService.ToolTip="{ext:Locale Name=Reload}">
                    <ic:SymbolIcon FontSize="14" Symbol="ArrowSync" />
                </Button>
                <ContentControl
                    x:Name="RightPanel"
                    Grid.Column="4"
                    Content="{x:Bind RightContent, Mode=OneWay}"
                    Style="{StaticResource AppContentControlStyle}" />
            </Grid>
        </Grid>
    </Grid>
</local:PlayerControlBase>
