<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:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
                     xmlns:dialogs="clr-namespace:Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs"
                     xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
                     xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
                     mc:Ignorable="d"
                     x:Class="Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.LayerHintsDialogView"
                     x:DataType="dialogs:LayerHintsDialogViewModel"
                     WindowStartupLocation="CenterOwner"
                     Icon="/Assets/Images/Logo/application.ico"
                     Title="Artemis | Adaption hints"
                     Width="750"
                     Height="800">

    <Grid Margin="15" RowDefinitions="Auto,*,Auto">
        <Grid Grid.Row="0" ColumnDefinitions="*,Auto" RowDefinitions="Auto,Auto">
            <StackPanel Grid.Row="0" Orientation="Horizontal">
                <avalonia:MaterialIcon Kind="{CompiledBinding Layer.LayerBrush.Descriptor.Icon}" Width="24" Height="24" Margin="0 0 5 10" />
                <TextBlock Classes="h4" Text="{CompiledBinding Layer.Name}" TextWrapping="Wrap" />
            </StackPanel>

            <controls:HyperlinkButton Grid.Row="0"
                                      Grid.Column="1"
                                      VerticalAlignment="Top"
                                      NavigateUri="https://wiki.artemis-rgb.com/guides/user/profiles/layers/adaption-hints?mtm_campaign=artemis&amp;mtm_kwd=profile-editor">
                Learn more about adaption hints
            </controls:HyperlinkButton>

            <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Classes="subtitle" TextWrapping="Wrap">
                Add hints below to help decide where to place this layer when the profile is imported.
            </TextBlock>
        </Grid>

        <Border Grid.Row="1" Classes="card" Margin="0 15">
            <Panel>
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" IsVisible="{CompiledBinding AdaptionHints.Count}">
                    <ItemsControl ItemsSource="{CompiledBinding AdaptionHints}" Classes="adaption-hints">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Spacing="10" />
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border Classes="card-condensed">
                                    <ContentControl Content="{CompiledBinding}"></ContentControl>
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>

                <StackPanel IsVisible="{CompiledBinding !AdaptionHints.Count}" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <avalonia:MaterialIcon Kind="AlertCircleOutline" HorizontalAlignment="Center" Width="48" Height="48" />
                    <TextBlock Classes="h4" TextAlignment="Center" TextWrapping="Wrap">
                        You haven't set up any adaption hints
                    </TextBlock>
                    <TextBlock Classes="subtitle" TextAlignment="Center" TextWrapping="Wrap">
                        Artemis will attempt to directly map the LEDs of this layer to different surfaces but results may vary.
                    </TextBlock>
                </StackPanel>
            </Panel>

        </Border>

        <Grid Grid.Row="2" ColumnDefinitions="*,Auto">
            <Button Grid.Row="0" Grid.Column="0" Command="{CompiledBinding AutoDetermineHints}">Auto-determine hints</Button>
            <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Spacing="5">
                <DropDownButton>
                    <DropDownButton.Flyout>
                        <MenuFlyout Placement="Top">
                            <MenuItem Header="Category hint" Command="{CompiledBinding AddCategoryHint}">
                                <MenuItem.Icon>
                                    <avalonia:MaterialIcon Kind="Desk" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="Device type hint" Command="{CompiledBinding AddDeviceHint}">
                                <MenuItem.Icon>
                                    <avalonia:MaterialIcon Kind="Devices" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="Keyboard-section hint" Command="{CompiledBinding AddKeyboardSectionHint}">
                                <MenuItem.Icon>
                                    <avalonia:MaterialIcon Kind="Keyboard" />
                                </MenuItem.Icon>
                            </MenuItem>
                        </MenuFlyout>
                    </DropDownButton.Flyout>
                    Add hint
                </DropDownButton>
                <Button Command="{CompiledBinding Finish}">Close</Button>
            </StackPanel>
        </Grid>

    </Grid>
</windowing:AppWindow>