<local:SettingSectionControl
    x:Class="Bili.App.Controls.PlayerModeSettingSection"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converter="using:Bili.App.Resources.Converter"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:enums="using:Bili.Models.Enums"
    xmlns:labs="using:CommunityToolkit.Labs.WinUI"
    xmlns:loc="using:Bili.App.Resources.Extension"
    xmlns:local="using:Bili.App.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:player="using:Bili.Models.Enums.Player"
    xmlns:uwp="using:Richasy.FluentIcon.Uwp"
    d:DesignHeight="300"
    d:DesignWidth="400"
    mc:Ignorable="d">

    <local:SettingSectionControl.Resources>
        <converter:PlayerDisplayModeConverter x:Key="PlayerDisplayModeConverter" />
        <converter:PreferQualityConverter x:Key="PreferQualityConverter" />
    </local:SettingSectionControl.Resources>

    <labs:SettingsExpander Description="{loc:Locale Name=PlayerModeDescription}" Header="{loc:Locale Name=PlayerMode}">
        <labs:SettingsExpander.HeaderIcon>
            <uwp:RegularFluentIcon Symbol="Replay20" />
        </labs:SettingsExpander.HeaderIcon>
        <labs:SettingsExpander.Items>
            <labs:SettingsCard Header="{loc:Locale Name=DefaultPlayerDisplayMode}">
                <ComboBox
                    MinWidth="120"
                    ItemsSource="{x:Bind ViewModel.PlayerDisplayModeCollection, Mode=OneWay}"
                    SelectedItem="{x:Bind ViewModel.DefaultPlayerDisplayMode, Mode=TwoWay}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate x:DataType="enums:PlayerDisplayMode">
                            <TextBlock Text="{x:Bind Converter={StaticResource PlayerDisplayModeConverter}}" />
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </labs:SettingsCard>
            <labs:SettingsCard Header="{loc:Locale Name=PreferQuality}">
                <ComboBox
                    MinWidth="120"
                    ItemsSource="{x:Bind ViewModel.PreferQualities}"
                    SelectedItem="{x:Bind ViewModel.PreferQuality, Mode=TwoWay}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate x:DataType="player:PreferQuality">
                            <TextBlock Text="{x:Bind Converter={StaticResource PreferQualityConverter}}" />
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </labs:SettingsCard>
            <labs:SettingsCard Header="{loc:Locale Name=AutoPlayWhenLoaded}">
                <ToggleSwitch IsOn="{x:Bind ViewModel.IsAutoPlayWhenLoaded, Mode=TwoWay}" />
            </labs:SettingsCard>
            <labs:SettingsCard>
                <labs:SettingsCard.Header>
                    <StackPanel Orientation="Horizontal" Spacing="4">
                        <TextBlock VerticalAlignment="Center" Text="{loc:Locale Name=AutoNextRelatedVideo}" />
                        <uwp:RegularFluentIcon
                            VerticalAlignment="Center"
                            FontSize="12"
                            Foreground="{ThemeResource SystemFillColorAttentionBrush}"
                            Symbol="QuestionCircle16"
                            ToolTipService.ToolTip="{loc:Locale Name=AutoNextRelatedVideoDescription}" />
                    </StackPanel>
                </labs:SettingsCard.Header>
                <ToggleSwitch IsOn="{x:Bind ViewModel.IsAutoPlayNextRelatedVideo, Mode=TwoWay}" />
            </labs:SettingsCard>
            <labs:SettingsCard>
                <labs:SettingsCard.Header>
                    <StackPanel Orientation="Horizontal" Spacing="4">
                        <TextBlock VerticalAlignment="Center" Text="{loc:Locale Name=ContinuousPlay}" />
                        <uwp:RegularFluentIcon
                            VerticalAlignment="Center"
                            FontSize="12"
                            Foreground="{ThemeResource SystemFillColorAttentionBrush}"
                            Symbol="QuestionCircle16"
                            ToolTipService.ToolTip="{loc:Locale Name=ContinuousPlayDescription}" />
                    </StackPanel>
                </labs:SettingsCard.Header>
                <ToggleSwitch IsOn="{x:Bind ViewModel.IsContinusPlay, Mode=TwoWay}" />
            </labs:SettingsCard>
            <labs:SettingsCard Description="{loc:Locale Name=DisableP2PCdnDescription}" Header="{loc:Locale Name=DisableP2PCdn}">
                <ToggleSwitch IsOn="{x:Bind ViewModel.DisableP2PCdn, Mode=TwoWay}" />
            </labs:SettingsCard>
        </labs:SettingsExpander.Items>
    </labs:SettingsExpander>
</local:SettingSectionControl>
