<?xml version="1.0" encoding="utf-8"?>
<Page
    x:Class="AppControlManager.Pages.CodeIntegrityInfo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AppControlManager.Pages"
    xmlns:ci="using:AppControlManager.CodeIntegrity"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ui="using:CommunityToolkit.WinUI"
    xmlns:controls="using:CommunityToolkit.WinUI.Controls"
    mc:Ignorable="d">

    <ScrollViewer>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Button x:Name="RetrieveCodeIntegrityInfo"
                Content="Retrieve Code Integrity Info"
                Click="RetrieveCodeIntegrityInfo_Click"
                ToolTipService.ToolTip="Retrieve the latest effective Code Integrity information from the current system"
                HorizontalAlignment="Center"
                VerticalAlignment="Top"
                Style="{StaticResource AccentButtonStyle}"
                Margin="0,0,0,10"
                Grid.Row="0"/>

            <ListView Grid.Row="1" Name="CodeIntegrityInfoListView" HorizontalAlignment="Center" SelectionMode="None">
                <!-- ListView Headers -->
                <ListView.Header>
                    <Grid ColumnSpacing="16">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Margin="0,10,0,10" Style="{ThemeResource TitleTextBlockStyle}" HorizontalAlignment="Center" Text="Effective Code Integrity Features" />
                    </Grid>
                </ListView.Header>

                <!-- DataTemplate for each CodeIntegrityOption -->
                <ListView.ItemTemplate>
                    <DataTemplate x:DataType="ci:CodeIntegrityOption">
                        <!-- Correct binding to the class -->
                        <Grid Padding="16,12" ColumnSpacing="16">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <!-- Bind only the Description properties from CodeIntegrityOption -->
                            <TextBox IsReadOnly="True" TextWrapping="Wrap" Text="{x:Bind Description}" Margin="0,0,0,10" />
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>

                <ListView.ItemContainerStyle>
                    <Style BasedOn="{StaticResource DefaultListViewItemStyle}" TargetType="ListViewItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    </Style>
                </ListView.ItemContainerStyle>
            </ListView>

            <Line Stroke="LightPink" HorizontalAlignment="Center"
      X1="0" Y1="0"
      X2="500" Y2="0"
      StrokeThickness="2" Grid.Row="2" Margin="0,10,0,10"/>


            <controls:WrapPanel Margin="10,10,0,10" HorizontalAlignment="Center" Orientation="Vertical" HorizontalSpacing="10" VerticalSpacing="15" Grid.Row="3">
                <TextBlock Text="Application Control for Business Status" Style="{ThemeResource TitleTextBlockStyle}" />
                <TextBox x:Name="UMCI" TextWrapping="Wrap" IsReadOnly="True" Header="User Mode Code Integrity" />
                <TextBox x:Name="KMCI" TextWrapping="Wrap" IsReadOnly="True" Header="Kernel Mode Code Integrity" />
            </controls:WrapPanel>

        </Grid>

    </ScrollViewer>

</Page>
