<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:RodelAgent.UI.Controls"
    xmlns:ext="using:RodelAgent.UI.Extensions"
    xmlns:ic="using:FluentIcons.WinUI"
    xmlns:local="using:RodelAgent.UI.Controls.Items">

    <Style TargetType="local:DrawModelCard">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DrawModelCard">
                    <Grid
                        Padding="16,8,8,12"
                        Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                        CornerRadius="{StaticResource ControlCornerRadius}"
                        RowSpacing="4">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBlock
                                VerticalAlignment="Center"
                                Style="{StaticResource BodyStrongTextBlockStyle}"
                                Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                                TextTrimming="CharacterEllipsis"
                                TextWrapping="NoWrap" />
                            <Button
                                Grid.Column="1"
                                Margin="8,0,0,0"
                                VerticalAlignment="Center"
                                AutomationProperties.Name="{ext:Locale Name=MoreOptions}"
                                Style="{StaticResource MiniIconButtonStyle}"
                                ToolTipService.ToolTip="{ext:Locale Name=MoreOptions}"
                                Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Data.IsCustomModel}">
                                <ic:SymbolIcon FontSize="14" Symbol="MoreVertical" />
                                <Button.Flyout>
                                    <MenuFlyout Placement="Bottom">
                                        <MenuFlyoutItem
                                            MinWidth="160"
                                            Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.ModifyCommand}"
                                            Text="{ext:Locale Name=Modify}">
                                            <MenuFlyoutItem.Icon>
                                                <ic:SymbolIcon Symbol="Edit" />
                                            </MenuFlyoutItem.Icon>
                                        </MenuFlyoutItem>
                                        <MenuFlyoutItem
                                            MinWidth="160"
                                            Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.DeleteCommand}"
                                            Text="{ext:Locale Name=Delete}">
                                            <MenuFlyoutItem.Icon>
                                                <ic:SymbolIcon Foreground="{ThemeResource SystemFillColorCriticalBrush}" Symbol="Delete" />
                                            </MenuFlyoutItem.Icon>
                                        </MenuFlyoutItem>
                                    </MenuFlyout>
                                </Button.Flyout>
                            </Button>
                        </Grid>

                        <TextBlock
                            Grid.Row="1"
                            VerticalAlignment="Center"
                            Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                            Style="{StaticResource BodyTextBlockStyle}"
                            Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Id}"
                            TextTrimming="CharacterEllipsis"
                            TextWrapping="NoWrap" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="PredefinedDrawModelCardStyle" TargetType="local:DrawModelCard">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DrawModelCard">
                    <Grid
                        Padding="16,8,8,8"
                        Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                        CornerRadius="{StaticResource ControlCornerRadius}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBlock
                            VerticalAlignment="Center"
                            Style="{StaticResource BodyStrongTextBlockStyle}"
                            Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                            TextTrimming="CharacterEllipsis"
                            TextWrapping="NoWrap" />

                        <TextBlock
                            Grid.Row="1"
                            Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                            Style="{StaticResource BodyTextBlockStyle}"
                            Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Id}"
                            TextTrimming="CharacterEllipsis"
                            TextWrapping="NoWrap" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SessionDrawModelCardStyle" TargetType="local:DrawModelCard">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DrawModelCard">
                    <controls:CardPanel
                        x:Name="RootCard"
                        MinWidth="260"
                        AutomationProperties.Name="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                        Background="Transparent"
                        IsChecked="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSelected}">
                        <Grid Margin="12,8" ColumnSpacing="8">
                            <TextBlock
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                                TextTrimming="CharacterEllipsis" />
                        </Grid>
                    </controls:CardPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
