<!--
    Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
    the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.Compatibility"
      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:local="using:Microsoft.Terminal.Settings.Editor"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
      mc:Ignorable="d">

    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="CommonResources.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <DataTemplate x:Key="EnumComboBoxTemplate"
                          x:DataType="local:EnumEntry">
                <TextBlock Text="{x:Bind EnumName}" />
            </DataTemplate>
        </ResourceDictionary>
    </Page.Resources>

    <StackPanel Style="{StaticResource SettingsStackStyle}">
        <!--  Allow Headless  -->
        <local:SettingContainer x:Name="AllowHeadless"
                                x:Uid="Globals_AllowHeadless">
            <ToggleSwitch IsOn="{x:Bind ViewModel.AllowHeadless, Mode=TwoWay}"
                          Style="{StaticResource ToggleSwitchInExpanderStyle}" />
        </local:SettingContainer>

        <!--  Text Measurement  -->
        <local:SettingContainer x:Name="TextMeasurement"
                                x:Uid="Globals_TextMeasurement">
            <ComboBox AutomationProperties.AccessibilityView="Content"
                      ItemTemplate="{StaticResource EnumComboBoxTemplate}"
                      ItemsSource="{x:Bind ViewModel.TextMeasurementList}"
                      SelectedItem="{x:Bind ViewModel.CurrentTextMeasurement, Mode=TwoWay}"
                      Style="{StaticResource ComboBoxSettingStyle}" />
        </local:SettingContainer>

        <!--  Ambiguous Width  -->
        <local:SettingContainer x:Name="AmbiguousWidth"
                                x:Uid="Globals_AmbiguousWidth">
            <ComboBox AutomationProperties.AccessibilityView="Content"
                      ItemTemplate="{StaticResource EnumComboBoxTemplate}"
                      ItemsSource="{x:Bind ViewModel.AmbiguousWidthList}"
                      SelectedItem="{x:Bind ViewModel.CurrentAmbiguousWidth, Mode=TwoWay}"
                      Style="{StaticResource ComboBoxSettingStyle}" />
        </local:SettingContainer>

        <!--  Debug Features  -->
        <local:SettingContainer x:Name="DebugFeaturesEnabled"
                                x:Uid="Globals_DebugFeaturesEnabled"
                                Visibility="{x:Bind ViewModel.DebugFeaturesAvailable}">
            <ToggleSwitch IsOn="{x:Bind ViewModel.DebugFeaturesEnabled, Mode=TwoWay}"
                          Style="{StaticResource ToggleSwitchInExpanderStyle}" />
        </local:SettingContainer>

        <!--  Reset Application State  -->
        <local:SettingContainer x:Name="ResetApplicationState"
                                x:Uid="Settings_ResetApplicationState">
            <Button x:Uid="Settings_ResetApplicationStateButton"
                    Style="{StaticResource DeleteButtonStyle}">
                <Button.Flyout>
                    <Flyout x:Name="ResetCacheFlyout"
                            FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}">
                        <StackPanel>
                            <TextBlock x:Uid="Settings_ResetApplicationStateConfirmationMessageHeader"
                                       Style="{StaticResource CustomFlyoutTextStyle}" />
                            <TextBlock x:Uid="Settings_ResetApplicationStateConfirmationMessageBody"
                                       FontWeight="Normal"
                                       Style="{StaticResource CustomFlyoutTextStyle}" />
                            <Button x:Uid="Settings_ResetApplicationStateConfirmationButton"
                                    Click="ResetApplicationStateButton_Click" />
                        </StackPanel>
                    </Flyout>
                </Button.Flyout>
            </Button>
        </local:SettingContainer>

        <!--  Reset to Default Settings  -->
        <local:SettingContainer x:Name="ResetToDefaultSettings"
                                x:Uid="Settings_ResetToDefaultSettings">
            <Button x:Uid="Settings_ResetToDefaultSettingsButton"
                    Style="{StaticResource DeleteButtonStyle}">
                <Button.Flyout>
                    <Flyout FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}">
                        <StackPanel>
                            <TextBlock x:Uid="Settings_ResetToDefaultSettingsConfirmationMessageHeader"
                                       Style="{StaticResource CustomFlyoutTextStyle}" />
                            <TextBlock x:Uid="Settings_ResetToDefaultSettingsConfirmationMessageBody"
                                       FontWeight="Normal"
                                       Style="{StaticResource CustomFlyoutTextStyle}" />
                            <Button x:Uid="Settings_ResetToDefaultSettingsConfirmationButton"
                                    Click="{x:Bind ViewModel.ResetToDefaultSettings}" />
                        </StackPanel>
                    </Flyout>
                </Button.Flyout>
            </Button>
        </local:SettingContainer>

    </StackPanel>
</Page>
