<windowing:AppWindow xmlns="https://github.com/avaloniaui"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:scripting="clr-namespace:Artemis.UI.Screens.Scripting"
                     xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
                     xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
                     xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
                     mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
                     x:Class="Artemis.UI.Screens.Scripting.ScriptsDialogView"
                     x:DataType="scripting:ScriptsDialogViewModel"
                     Icon="/Assets/Images/Logo/application.ico"
                     Title="Artemis | Scripts"
                     Width="1200"
                     Height="750">
    <DockPanel>
        <ScrollViewer DockPanel.Dock="Left" VerticalScrollBarVisibility="Auto" Width="300" Margin="10">
            <StackPanel>
                <ListBox ItemsSource="{CompiledBinding ScriptConfigurations}" SelectedItem="{CompiledBinding SelectedScript}">
                    <ListBox.ItemTemplate>
                        <DataTemplate DataType="{x:Type scripting:ScriptConfigurationViewModel}">
                            <Grid ColumnDefinitions="Auto,*,Auto,Auto" RowDefinitions="*,*" Margin="4">
                                <shared:ArtemisIcon Grid.Row="0"
                                                    Grid.Column="0"
                                                    Grid.RowSpan="2"
                                                    Icon="{CompiledBinding ScriptConfiguration.Script.ScriptingProvider.Plugin.Info.ResolvedIcon, FallbackValue=QuestionMark}"
                                                    Width="32 "
                                                    Height="32"
                                                    Margin="0 0 10 0"
                                                    VerticalAlignment="Center" />
                                <TextBlock Grid.Row="0"
                                           Grid.Column="1"
                                           VerticalAlignment="Center"
                                           Text="{CompiledBinding ScriptConfiguration.Name}"
                                           IsVisible="{CompiledBinding !ScriptConfiguration.HasChanges}"
                                           TextTrimming="CharacterEllipsis" />
                                <StackPanel Grid.Row="0"
                                            Grid.Column="1"
                                            VerticalAlignment="Center"
                                            Orientation="Horizontal"
                                            IsVisible="{CompiledBinding ScriptConfiguration.HasChanges}">
                                    <TextBlock Text="{CompiledBinding ScriptConfiguration.Name}" FontWeight="Bold"></TextBlock>
                                    <TextBlock Text="*"></TextBlock>
                                </StackPanel>
                                <TextBlock Grid.Row="1"
                                           Grid.Column="1"
                                           Text="{CompiledBinding ScriptConfiguration.Script.ScriptingProvider.LanguageName, FallbackValue='Unknown scripting provider'}"
                                           Classes="subtitle"
                                           FontSize="11"
                                           VerticalAlignment="Center" />

                                <Button Classes="icon-button icon-button-small"
                                        Grid.Row="0"
                                        Grid.RowSpan="2"
                                        Grid.Column="2"
                                        ToolTip.Tip="Edit script"
                                        HorizontalAlignment="Right"
                                        Command="{CompiledBinding EditScriptConfiguration}"
                                        CommandParameter="{CompiledBinding ScriptConfiguration}"
                                        Margin="0 0 2 0">
                                    <avalonia:MaterialIcon Kind="Cog" />
                                </Button>
                                <Button Classes="icon-button icon-button-small"
                                        Command="{CompiledBinding ToggleSuspended}"
                                        Grid.Row="0"
                                        Grid.RowSpan="2"
                                        Grid.Column="3"
                                        ToolTip.Tip="Suspend/resume script">
                                    <Panel>
                                        <avalonia:MaterialIcon Kind="EyeOff" IsVisible="{CompiledBinding ScriptConfiguration.IsSuspended}" />
                                        <avalonia:MaterialIcon Kind="Eye" IsVisible="{CompiledBinding !ScriptConfiguration.IsSuspended}" />
                                    </Panel>
                                </Button>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <Button Content="Add new script"
                        Margin="10"
                        HorizontalAlignment="Stretch"
                        Command="{CompiledBinding AddScriptConfiguration}" />
            </StackPanel>
        </ScrollViewer>

        <Border DockPanel.Dock="Top" Classes="router-container" Margin="0 10 0 0">
            <ContentControl Content="{CompiledBinding ScriptEditorViewModel}" />
        </Border>
    </DockPanel>

</windowing:AppWindow>