<?xml version="1.0" encoding="utf-8"?>
<Page
    x:Class="Sonex.Client.Pages.Administrator.SystemLogs.ApplicationErrors"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:tk="using:CommunityToolkit.WinUI.Controls"
    xmlns:controls="using:Sonex.Client.Controls"
    xmlns:datagrid="using:Sonex.Client.Controls.DataGridView"
    xmlns:filters="using:Sonex.Client.Controls.Filters"
    xmlns:views="using:Sonex.Client.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{StaticResource SolidBackgroundFillColorBaseBrush}" Padding="8,0,8,8" RowSpacing="8">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" MinHeight="0" />
        </Grid.RowDefinitions>

        <filters:SqlFilterBuilder Grid.Row="0" x:Name="RootFilter" AutoApplyDefaultFilters="True" />

        <controls:TabView x:Name="DetailsTabView" Grid.Row="1">
            <controls:TabView.HeaderCommandBar>
                <CommandBar>
                    <AppBarButton x:Name="RefreshDetailsButton" Label="Refresh" Click="RefreshButton_Click">
                        <AppBarButton.Icon>
                            <FontIcon Glyph="&#xE72C;" />
                        </AppBarButton.Icon>
                    </AppBarButton>
                </CommandBar>
            </controls:TabView.HeaderCommandBar>
            <controls:TabViewItem Header="Log information" KeyPath="ErrorId">
                <views:AppLogDetailsView x:Name="LogDetailsView" />
            </controls:TabViewItem>
            <controls:TabViewItem Header="Diagnostics" KeyPath="ErrorId">
                <views:AppLogDiagnosticsView x:Name="LogDiagnosticsView" />
            </controls:TabViewItem>
        </controls:TabView>

        <datagrid:DataGridViewPanel
            x:Name="DataGrid"
            Grid.Row="2"
            HeaderHeight="25"
            RowsHeight="21"
            OnChangeActiveRow="DataGrid_OnChangeActiveRow"
            RefreshRequested="DataGrid_RefreshRequested" />

        <tk:GridSplitter Grid.Row="2" Height="8" VerticalAlignment="Top">
            <tk:GridSplitter.RenderTransform>
                <TranslateTransform Y="-8" />
            </tk:GridSplitter.RenderTransform>
        </tk:GridSplitter>
    </Grid>
</Page>
