<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:controls="clr-namespace:GalaxyBudsClient.Interface.Controls"
             xmlns:ext="clr-namespace:GalaxyBudsClient.Interface.MarkupExtensions"
             xmlns:pages="clr-namespace:GalaxyBudsClient.Interface.ViewModels.Pages"
             xmlns:i18N="clr-namespace:GalaxyBudsClient.Generated.I18N"
             mc:Ignorable="d" d:DesignWidth="800"
             x:Class="GalaxyBudsClient.Interface.Pages.NoiseControlPage"
             x:DataType="pages:NoiseControlPageViewModel"
             x:CompileBindings="True">

    <Design.DataContext>
        <pages:NoiseControlPageViewModel />
    </Design.DataContext>

    <ScrollViewer>
        <StackPanel Spacing="8" Margin="{StaticResource AppPageMargin}">
            <Interaction.Behaviors>
                <ext:RequiresConnectedDeviceBehavior />
            </Interaction.Behaviors>
            
            <controls:SettingsGroup>
                <Interaction.Behaviors>
                    <ext:RequiresFeatureBehavior Feature="AmbientSound" />
                </Interaction.Behaviors>

                <controls:SettingsSwitchItem
                    Content="{ext:Translate {x:Static i18N:Keys.AsEnable}}"
                    Description="{ext:Translate {x:Static i18N:Keys.AsHeaderDescription}}"
                    Symbol="MicSparkle"
                    IsChecked="{Binding IsAmbientSoundEnabled}" />

                <controls:SettingsSymbolItem Content="{ext:Translate {x:Static i18N:Keys.NcAsHeader}}"
                                             Description="{ext:Translate {x:Static i18N:Keys.NcAsCustom}}"
                                             Symbol="Wrench"
                                             ActionSymbol="ChevronRight"
                                             IsEnabled="{Binding IsAmbientSoundEnabled}"
                                             IsClickEnabled="True">
                    <Interaction.Behaviors>
                        <EventTriggerBehavior EventName="Click">
                            <ext:NavigationToPageAction PageType="{x:Type pages:AmbientCustomizePageViewModel}" />
                        </EventTriggerBehavior>
                    </Interaction.Behaviors>
                </controls:SettingsSymbolItem>

            </controls:SettingsGroup>

            <controls:SettingsGroup>
                <Interaction.Behaviors>
                    <ext:RequiresFeatureBehavior Feature="Anc" />
                </Interaction.Behaviors>

                <controls:SettingsSwitchItem
                    Content="{ext:Translate {x:Static i18N:Keys.Anc}}"
                    Description="{ext:Translate {x:Static i18N:Keys.NcAsAncDescription}}"
                    Symbol="HeadphonesSoundWave"
                    IsChecked="{Binding IsAncEnabled}" />

                <controls:SettingsSwitchItem
                    Content="{ext:Translate {x:Static i18N:Keys.NcAncLevel}}"
                    Description="{ext:Translate {x:Static i18N:Keys.NcAncLevelDescription}}"
                    Symbol="AddCircle"
                    IsEnabled="{Binding IsAncEnabled}"
                    IsChecked="{Binding IsAncLevelHigh}">
                    <Interaction.Behaviors>
                        <ext:RequiresFeatureBehavior Feature="AncNoiseReductionLevels" />
                    </Interaction.Behaviors>
                </controls:SettingsSwitchItem>
            </controls:SettingsGroup>

            <controls:SettingsGroup>
                <Interaction.Behaviors>
                    <ext:RequiresFeatureBehavior Feature="NoiseControlsWithOneEarbud" />
                </Interaction.Behaviors>
                
                <controls:SettingsSwitchItem
                    Content="{ext:Translate {x:Static i18N:Keys.NcOneEarbud}}"
                    Description="{ext:Translate {x:Static i18N:Keys.NcOneEarbudDescription}}"
                    Symbol="Accessibility"
                    IsChecked="{Binding IsNcWithOneEarbudAllowed}">
                </controls:SettingsSwitchItem>
            </controls:SettingsGroup>
            
            
            <controls:SettingsGroup>
                <Interaction.Behaviors>
                    <ext:RequiresFeatureBehavior Feature="DetectConversations" />
                </Interaction.Behaviors>

                <controls:SettingsSwitchItem
                    Content="{ext:Translate {x:Static i18N:Keys.NcVoicedetect}}"
                    Description="{ext:Translate {x:Static i18N:Keys.NcVoicedetectDescription}}"
                    Symbol="PersonVoice"
                    IsChecked="{Binding IsVoiceDetectEnabled}" />

                <controls:SettingsComboBoxItem
                    Content="{ext:Translate {x:Static i18N:Keys.NcVoicedetectTimeout}}"
                    Description="{ext:Translate {x:Static i18N:Keys.NcVoicedetectTimeoutDescription}}"
                    Symbol="Timer"
                    IsEnabled="{Binding IsVoiceDetectEnabled}"
                    ItemsSource="{Binding Source={ext:VoiceDetectTimeoutsBindingSource}}"
                    SelectedValue="{Binding VoiceDetectTimeout}">
                    <Interaction.Behaviors>
                        <ext:LocalizationAwareComboBoxBehavior /> 
                    </Interaction.Behaviors>
                </controls:SettingsComboBoxItem>

            </controls:SettingsGroup>

        </StackPanel>
    </ScrollViewer>

</UserControl>