<UserControl x:Class="UniGetUI.Avalonia.Views.Pages.SettingsPages.Notifications"
             xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:automation="clr-namespace:Avalonia.Automation;assembly=Avalonia.Controls"
             xmlns:vm="using:UniGetUI.Avalonia.ViewModels.Pages.SettingsPages"
             xmlns:settings="using:UniGetUI.Avalonia.Views.Controls.Settings"
             xmlns:t="using:UniGetUI.Avalonia.MarkupExtensions"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:DataType="vm:NotificationsViewModel">

    <ScrollViewer HorizontalScrollBarVisibility="Disabled">
        <StackPanel Orientation="Vertical">

            <settings:TranslatedTextBlock Text="Notification preferences"
                                          FontSize="14"
                                          FontWeight="SemiBold"
                                          Margin="44,32,4,8"
                                          automation:AutomationProperties.HeadingLevel="2"/>

            <!-- Warning shown when system tray is disabled (Windows-only) -->
            <TextBlock Text="{t:Translate The system tray icon must be enabled in order for notifications to work}"
                       FontSize="14"
                       Margin="0,0,0,8"
                       HorizontalAlignment="Center"
                       Foreground="OrangeRed"
                       IsVisible="{Binding IsSystemTrayWarningVisible}"/>

            <settings:CheckboxCard x:Name="NotificationsMainCard"
                                   SettingName="DisableNotifications"
                                   Text="{t:Translate Enable UniGetUI notifications}"
                                   StateChangedCommand="{Binding UpdateNotificationsEnabledCommand}"
                                   CornerRadius="8,8,0,0"
                                   IsEnabled="{Binding IsSystemTrayWarningVisible, Converter={x:Static BoolConverters.Not}}"/>

            <!-- In-app summary toast (works on all platforms, so not in the OS-only group below) -->
            <settings:CheckboxCard x:Name="SummaryToastCard"
                                   SettingName="ShowOperationSummaryNotifications"
                                   Text="{t:Translate Show an in-app summary toast when a batch of operations finishes}"
                                   BorderThickness="1,0,1,1"
                                   CornerRadius="0,0,8,8"/>

            <!-- Notification types are Windows/macOS-only (no Linux delivery path). -->
            <StackPanel Orientation="Vertical" IsVisible="{Binding AreNotificationTypesSupported}">

                <settings:TranslatedTextBlock Text="Notification types"
                                              FontSize="14"
                                              FontWeight="SemiBold"
                                              Margin="44,32,4,8"
                                              automation:AutomationProperties.HeadingLevel="2"/>

                <settings:CheckboxCard x:Name="NotificationTypesCard"
                                       SettingName="DisableUpdatesNotifications"
                                       Text="{t:Translate Show a notification when there are available updates}"
                                       CornerRadius="8,8,0,0"
                                       IsEnabled="{Binding IsNotificationsEnabled}"/>

                <settings:CheckboxCard x:Name="ProgressNotificationCard"
                                       SettingName="DisableProgressNotifications"
                                       Text="{t:Translate Show a silent notification when an operation is running}"
                                       BorderThickness="1,0"
                                       CornerRadius="0"
                                       IsEnabled="{Binding IsNotificationsEnabled}"/>

                <settings:CheckboxCard x:Name="ErrorNotificationCard"
                                       SettingName="DisableErrorNotifications"
                                       Text="{t:Translate Show a notification when an operation fails}"
                                       CornerRadius="0"
                                       IsEnabled="{Binding IsNotificationsEnabled}"/>

                <settings:CheckboxCard x:Name="SuccessNotificationCard"
                                       SettingName="DisableSuccessNotifications"
                                       Text="{t:Translate Show a notification when an operation finishes successfully}"
                                       BorderThickness="1,0,1,1"
                                       CornerRadius="0,0,8,8"
                                       IsEnabled="{Binding IsNotificationsEnabled}"/>
            </StackPanel>

        </StackPanel>
    </ScrollViewer>

</UserControl>
