<?xml version="1.0" encoding="utf-8" ?>
<local:SettingsPageControlBase
    x:Class="BiliCopilot.UI.Controls.Settings.PlayerControlSettingControl"
    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:constants="using:BiliCopilot.UI.Models.Constants"
    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.Settings"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <UserControl.Resources>
        <converters:PreferCodecTypeConverter x:Key="PreferCodecConverter" />
        <converters:MTCBehaviorConverter x:Key="MTCConverter" />
    </UserControl.Resources>

    <base:SettingsExpander Description="{ext:Locale Name=PlayerControlDescription}" Header="{ext:Locale Name=PlayerControl}">
        <base:SettingsExpander.HeaderIcon>
            <ic:SymbolIcon Symbol="VideoPlayPause" />
        </base:SettingsExpander.HeaderIcon>
        <base:SettingsExpander.Items>
            <base:SettingsCard Description="{ext:Locale Name=MTCBehaviorDescription}" Header="{ext:Locale Name=MTCBehavior}">
                <ComboBox
                    MinWidth="120"
                    ItemsSource="{x:Bind ViewModel.MTCBehaviorCollection, Mode=OneWay}"
                    SelectedItem="{x:Bind ViewModel.MTCBehavior, Mode=TwoWay}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate x:DataType="constants:MTCBehavior">
                            <TextBlock Text="{x:Bind Converter={StaticResource MTCConverter}}" />
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </base:SettingsCard>
            <base:SettingsCard Description="{ext:Locale Name=PreferCodecDescription}" Header="{ext:Locale Name=PreferCodec}">
                <ComboBox
                    MinWidth="120"
                    ItemsSource="{x:Bind ViewModel.PreferCodecCollection, Mode=OneWay}"
                    SelectedItem="{x:Bind ViewModel.PreferCodec, Mode=TwoWay}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate x:DataType="constants:PreferCodecType">
                            <TextBlock Text="{x:Bind Converter={StaticResource PreferCodecConverter}}" />
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </base:SettingsCard>
            <base:SettingsCard Description="{ext:Locale Name=SingleFastForwardAndRewindSpanDescription}" Header="{ext:Locale Name=SingleFastForwardAndRewindSpan}">
                <NumberBox
                    MinWidth="120"
                    LargeChange="50"
                    Maximum="300"
                    Minimum="3"
                    SmallChange="10"
                    SpinButtonPlacementMode="Compact"
                    Value="{x:Bind ViewModel.SingleFastForwardAndRewindSpan, Mode=TwoWay}" />
            </base:SettingsCard>
            <base:SettingsCard Description="{ext:Locale Name=GlobalPlaybackRateDescription}" Header="{ext:Locale Name=GlobalPlaybackRate}">
                <ToggleSwitch IsOn="{x:Bind ViewModel.GlobalPlayerSpeed, Mode=TwoWay}" />
            </base:SettingsCard>
            <base:SettingsCard Description="{ext:Locale Name=PlaybackRateEnhancementDescription}" Header="{ext:Locale Name=PlaybackRateEnhancement}">
                <ToggleSwitch IsOn="{x:Bind ViewModel.PlayerSpeedEnhancement, Mode=TwoWay}" />
            </base:SettingsCard>
            <base:SettingsCard Description="{ext:Locale Name=BottomProgressVisibleDescription}" Header="{ext:Locale Name=BottomProgressVisible}">
                <ToggleSwitch IsOn="{x:Bind ViewModel.BottomProgressVisible, Mode=TwoWay}" />
            </base:SettingsCard>
        </base:SettingsExpander.Items>
    </base:SettingsExpander>
</local:SettingsPageControlBase>
