<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:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
             xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
             xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
             xmlns:local="clr-namespace:Artemis.UI.Screens.Device"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:DataType="local:DeviceSettingsViewModel"
             x:Class="Artemis.UI.Screens.Device.DeviceSettingsView">
    <Border Classes="card" Padding="0" Width="240" ClipToBounds="True" Margin="5">
        <Grid RowDefinitions="160,*,Auto">
            <Rectangle Grid.Row="0" Fill="{DynamicResource CheckerboardBrush}" />
            <shared:DeviceVisualizer Grid.Row="0"
                                     VerticalAlignment="Center"
                                     HorizontalAlignment="Center"
                                     Margin="10"
                                     ShowColors="False"
                                     Device="{CompiledBinding Device}"
                                     RenderOptions.BitmapInterpolationMode="MediumQuality" />
            <Button Grid.Row="0"
                    Classes="icon-button icon-button-large"
                    VerticalAlignment="Bottom"
                    HorizontalAlignment="Right"
                    Margin="5"
                    ToolTip.Tip="Identify"
                    Command="{CompiledBinding IdentifyDevice}">
                <avalonia:MaterialIcon Kind="AlarmLight" />
            </Button>
            <StackPanel Grid.Row="1" Margin="8 16 8 0">
                <TextBlock Text="{CompiledBinding Device.RgbDevice.DeviceInfo.Model}" />
                <StackPanel>
                    <TextBlock TextWrapping="Wrap" Classes="subtitle" Text="{CompiledBinding Device.RgbDevice.DeviceInfo.Manufacturer, Mode=OneWay}" />
                    <TextBlock TextWrapping="Wrap" Classes="subtitle" Text="{CompiledBinding Device.DeviceType, Mode=OneWay}" />
                </StackPanel>
            </StackPanel>

            <Grid Grid.Row="2" Margin="10" ColumnDefinitions="25,*">
                <CheckBox IsChecked="{CompiledBinding IsDeviceEnabled}" />

                <SplitButton Grid.Column="1" Content="Properties" Command="{CompiledBinding ViewProperties}" HorizontalAlignment="Right">
                    <SplitButton.Flyout>
                        <MenuFlyout Placement="Bottom">
                            <MenuItem Header="Open plugin directory" Command="{CompiledBinding OpenPluginDirectory}">
                                <MenuItem.Icon>
                                    <avalonia:MaterialIcon Kind="FolderOpen" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="Identity input" Command="{CompiledBinding DetectInput}">
                                <MenuItem.Icon>
                                    <avalonia:MaterialIcon Kind="GestureDoubleTap" />
                                </MenuItem.Icon>
                            </MenuItem>
                        </MenuFlyout>
                    </SplitButton.Flyout>
                </SplitButton>
            </Grid>
        </Grid>
    </Border>
</UserControl>