<?xml version="1.0" encoding="utf-8" ?>
<local:PgcFavoriteControlBase
    x:Class="BiliCopilot.UI.Controls.Favorites.PgcFavoriteHeader"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converters="using:BiliCopilot.UI.Converters"
    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.Favorites"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:models="using:Richasy.BiliKernel.Models"
    mc:Ignorable="d">

    <UserControl.Resources>
        <converters:PgcFavoriteStatusConverter x:Key="StatusConverter" />
    </UserControl.Resources>

    <Grid Padding="16,0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <local:PgcFavoriteSideItem
            VerticalAlignment="Center"
            FontWeight="Bold"
            ViewModel="{x:Bind ViewModel, Mode=OneWay}" />

        <StackPanel
            Grid.Column="2"
            VerticalAlignment="Center"
            Orientation="Horizontal"
            Spacing="8">
            <Button
                VerticalAlignment="Center"
                AutomationProperties.Name="{ext:Locale Name=Refresh}"
                Command="{x:Bind ViewModel.RefreshCommand, Mode=OneWay}"
                IsEnabled="{x:Bind ViewModel.IsLoading, Mode=OneWay, Converter={StaticResource ObjectToBoolReverseConverter}}">
                <StackPanel Orientation="Horizontal" Spacing="8">
                    <ic:SymbolIcon
                        VerticalAlignment="Center"
                        FontSize="12"
                        Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
                        Symbol="ArrowSync" />
                    <TextBlock VerticalAlignment="Center" Text="{ext:Locale Name=Refresh}" />
                </StackPanel>
            </Button>
            <ComboBox
                x:Name="StatusComboBox"
                MinWidth="120"
                VerticalAlignment="Center"
                ItemsSource="{x:Bind ViewModel.StatusList, Mode=OneWay}"
                SelectionChanged="OnStatusChanged">
                <ComboBox.ItemTemplate>
                    <DataTemplate x:DataType="models:PgcFavoriteStatus">
                        <TextBlock Text="{x:Bind Converter={StaticResource StatusConverter}}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </StackPanel>
    </Grid>
</local:PgcFavoriteControlBase>
