<UserControl 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:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
             xmlns:device="clr-namespace:Artemis.UI.Screens.Device"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="800"
             x:Class="Artemis.UI.Screens.Device.DeviceLayoutTabView"
             x:DataType="device:DeviceLayoutTabViewModel">
    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
        <Border Classes="card" Margin="5">
            <Grid RowDefinitions="*,Auto">
                <StackPanel Grid.Row="0">
                    <Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
                        <StackPanel Grid.Row="0" Grid.Column="0">
                            <TextBlock Text="Default layout file path" />
                            <TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding DefaultLayoutPath}" />
                        </StackPanel>
                        <StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
                            <Button
                                Classes="icon-button"
                                HorizontalAlignment="Right"
                                ToolTip.Tip="Copy layout file path to clipboard"
                                Click="LayoutPathButton_OnClick">
                                <avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
                            </Button>
                        </StackPanel>
                    </Grid>
                    <Border Classes="card-separator" />
                    <Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
                        <StackPanel Grid.Row="1" Grid.Column="0">
                            <TextBlock Text="Image file path" />
                            <TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding Device.Layout.Image.LocalPath}" />
                        </StackPanel>
                        <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
                            <Button
                                Classes="icon-button"
                                HorizontalAlignment="Right"
                                ToolTip.Tip="Copy image file path to clipboard"
                                Click="ImagePathButton_OnClick">
                                <avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
                            </Button>
                        </StackPanel>
                    </Grid>
                    <Border Classes="card-separator" />
                    <Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
                        <StackPanel Grid.Row="1" Grid.Column="0">
                            <TextBlock Text="Disable default layout" />
                            <TextBlock Classes="subtitle" FontSize="12" Text="With this checked, Artemis will not load a layout for this device unless you specifically provide one." />
                        </StackPanel>
                        <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
                            <CheckBox HorizontalAlignment="Right" Margin="0,0,-10,0" />
                        </StackPanel>
                    </Grid>
                    <Border Classes="card-separator" />
                    <Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
                        <StackPanel Grid.Row="1" Grid.Column="0">
                            <TextBlock Text="Custom layout path" />
                            <TextBlock Classes="subtitle" FontSize="12" Text="{CompiledBinding CustomLayoutPath}" />
                        </StackPanel>
                        <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal">
                            <Button Content="Clear" Command="{CompiledBinding ClearCustomLayout}" IsEnabled="{CompiledBinding HasCustomLayout}" />
                            <!-- 5 pixels of margin between the buttons -->
                            <Button Margin="5,0,0,0" Content="Browse" Command="{CompiledBinding BrowseCustomLayout}" />
                        </StackPanel>
                    </Grid>
                    <Border Classes="card-separator" />
                    <Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
                        <StackPanel Grid.Row="1" Grid.Column="0">
                            <TextBlock Text="Export current layout" />
                            <TextBlock Classes="subtitle" FontSize="12" Text="If there is a layout used, export that. Otherwise, export the LEDs present." />
                        </StackPanel>
                        <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal">
                            <Button HorizontalAlignment="Right" Content="Export" Command="{CompiledBinding ExportLayout}" />
                        </StackPanel>
                    </Grid>
                </StackPanel>
                <controls:HyperlinkButton
                    Grid.Row="1"
                    Content="Learn more about layouts on the wiki"
                    NavigateUri="https://wiki.artemis-rgb.com/en/guides/developer/layouts?mtm_campaign=artemis&amp;mtm_kwd=device-properties"
                    Margin="0 20"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Bottom" />
            </Grid>
        </Border>
    </ScrollViewer>
</UserControl>