<?xml version="1.0" encoding="utf-8" ?>
<Page
    x:Class="ServerMonitorManager_Desktop.SettingsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ScrollViewer>
        <StackPanel MaxWidth="840" HorizontalAlignment="Left" Spacing="20">
            <StackPanel Spacing="3">
                <TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="Настройки" />
                <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}" Text="Подключения, локальные ключи и обслуживание приложения" />
            </StackPanel>

            <Grid ColumnSpacing="16" RowSpacing="16">
                <Grid.ColumnDefinitions><ColumnDefinition Width="*" /><ColumnDefinition Width="*" /></Grid.ColumnDefinitions>
                <Grid.RowDefinitions><RowDefinition Height="Auto" /><RowDefinition Height="Auto" /></Grid.RowDefinitions>

                <Border Padding="18" Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" BorderThickness="1" CornerRadius="8">
                    <StackPanel Spacing="12">
                        <TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="Control Hub" />
                        <TextBlock x:Name="ControlStatusText" Foreground="{ThemeResource TextFillColorSecondaryBrush}" TextWrapping="Wrap" />
                        <Button HorizontalAlignment="Left" Click="ConnectControlButton_Click" Content="Подключить по SMMDEV1" Style="{StaticResource AccentButtonStyle}" />
                    </StackPanel>
                </Border>

                <Border Grid.Column="1" Padding="18" Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" BorderThickness="1" CornerRadius="8">
                    <StackPanel Spacing="12">
                        <TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="SSH-ключ мониторинга" />
                        <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}" Text="Ed25519 private key защищён Windows DPAPI и не передаётся Hub." TextWrapping="Wrap" />
                        <Button HorizontalAlignment="Left" Click="ShowSshKeyButton_Click" Content="Показать публичный ключ" />
                    </StackPanel>
                </Border>

                <Border Grid.Row="1" Padding="18" Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" BorderThickness="1" CornerRadius="8">
                    <StackPanel Spacing="12">
                        <TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="Мониторинг" />
                        <TextBlock Text="Интервал обновления: 30 секунд" />
                        <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}" Text="История: до 240 точек на сервер. Старые offline-точки уплотняются Linux Agent." TextWrapping="Wrap" />
                    </StackPanel>
                </Border>

                <Border Grid.Row="1" Grid.Column="1" Padding="18" Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" BorderThickness="1" CornerRadius="8">
                    <StackPanel Spacing="12">
                        <TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="Диагностика" />
                        <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}" Text="Экспорт не содержит адресов, пользователей, ключей, сертификатов или токенов." TextWrapping="Wrap" />
                        <Button HorizontalAlignment="Left" Click="ExportDiagnosticsButton_Click" Content="Экспортировать JSON" />
                    </StackPanel>
                </Border>
            </Grid>

            <InfoBar IsClosable="False" IsOpen="True" Message="Agent, Operator, terminal и Automation используют разные identities. Изменять Links может только Operator." Severity="Informational" Title="Безопасность" />
        </StackPanel>
    </ScrollViewer>
</Page>
