<UserControl
    x:Class="AppFramework.Views.AuditLogsDetailsView"
    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:extensions="clr-namespace:AppFramework.Extensions"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Width="800"
    Height="580"
    mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>

        <Border
            Grid.RowSpan="3"
            CornerRadius="0"
            Opacity="1"
            Style="{StaticResource BorderStyle}" />

        <TextBlock
            Margin="15"
            FontSize="18"
            FontWeight="Bold"
            Text="{extensions:Translate AuditLogDetail}" />

        <ScrollViewer
            Grid.Row="1"
            Margin="15,0"
            VerticalScrollBarVisibility="Auto">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>

                <!--  User Infomation  -->
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <TextBlock
                        Grid.ColumnSpan="2"
                        Margin="0,5"
                        FontSize="18"
                        FontWeight="Bold"
                        Text="{extensions:Translate UserInformations}" />

                    <TextBlock Grid.Row="1" Text="{extensions:Translate UserName}" />
                    <TextBlock
                        Grid.Row="1"
                        Grid.Column="1"
                        Text="{Binding AuditLog.UserName}" />

                    <TextBlock Grid.Row="2" Text="{extensions:Translate IpAddress}" />
                    <TextBlock
                        Grid.Row="2"
                        Grid.Column="1"
                        Text="{Binding AuditLog.ClientIpAddress}" />

                    <TextBlock Grid.Row="3" Text="{extensions:Translate Client}" />
                    <TextBlock
                        Grid.Row="3"
                        Grid.Column="1"
                        Text="{Binding AuditLog.ClientName}" />

                    <TextBlock Grid.Row="4" Text="{extensions:Translate Browser}" />
                    <TextBlock
                        Grid.Row="4"
                        Grid.Column="1"
                        Text="{Binding AuditLog.BrowserInfo}" />
                </Grid>

                <!--  Action Infomation  -->
                <Grid Grid.Row="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition Height="auto" />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <TextBlock
                        Grid.ColumnSpan="2"
                        Margin="0,5"
                        FontSize="18"
                        FontWeight="Bold"
                        Text="{extensions:Translate ActionInformations}" />

                    <TextBlock Grid.Row="1" Text="{extensions:Translate Service}" />
                    <TextBlock
                        Grid.Row="1"
                        Grid.Column="1"
                        Text="{Binding AuditLog.ServiceName}" />

                    <TextBlock Grid.Row="2" Text="{extensions:Translate Action}" />
                    <TextBlock
                        Grid.Row="2"
                        Grid.Column="1"
                        Text="{Binding AuditLog.MethodName}" />

                    <TextBlock Grid.Row="3" Text="{extensions:Translate Time}" />
                    <TextBlock
                        Grid.Row="3"
                        Grid.Column="1"
                        Text="{Binding AuditLog.ExecutionTime}" />

                    <TextBlock Grid.Row="4" Text="{extensions:Translate Duration}" />
                    <TextBlock
                        Grid.Row="4"
                        Grid.Column="1"
                        Text="{Binding AuditLog.ExecutionDuration}" />

                    <TextBlock Grid.Row="5" Text="{extensions:Translate Parameters}" />
                    <TextBlock
                        Grid.Row="5"
                        Grid.Column="1"
                        Text="{Binding AuditLog.Parameters}"
                        TextWrapping="Wrap" />
                </Grid>

                <!--  Custom Data  -->
                <Grid Grid.Row="2">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <TextBlock
                        Grid.ColumnSpan="2"
                        Margin="0,5"
                        FontSize="18"
                        FontWeight="Bold"
                        Text="{extensions:Translate CustomData}" />

                    <TextBlock Grid.Row="1" Text="{Binding AuditLog.CustomData}" />

                    <TextBlock
                        Grid.Row="2"
                        Grid.ColumnSpan="2"
                        Margin="0,5"
                        FontSize="18"
                        FontWeight="Bold"
                        Text="{extensions:Translate ErrorState}" />

                    <TextBlock Grid.Row="3" Text="{Binding AuditLog.Exception}" />
                </Grid>
            </Grid>
        </ScrollViewer>

        <StackPanel
            Grid.Row="2"
            Margin="15"
            HorizontalAlignment="Right"
            Orientation="Horizontal">
            <Button
                Padding="10,5"
                Command="{Binding CancelCommand}"
                Content="{extensions:Translate Close}" />
        </StackPanel>
    </Grid>
</UserControl>
