<?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:ChatModelCard">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ChatModelCard">
                    <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>

                        <Grid Grid.Row="1" ColumnSpacing="12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <TextBlock
                                VerticalAlignment="Center"
                                Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                                Style="{StaticResource BodyTextBlockStyle}"
                                Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Id}"
                                TextTrimming="CharacterEllipsis"
                                TextWrapping="NoWrap" />
                            <StackPanel
                                Grid.Column="1"
                                Margin="0,0,-8,0"
                                VerticalAlignment="Center"
                                Orientation="Horizontal">
                                <Grid
                                    Width="24"
                                    Height="24"
                                    Margin="0,0,8,0"
                                    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                    CornerRadius="{StaticResource ControlCornerRadius}"
                                    ToolTipService.ToolTip="{ext:Locale Name=SupportTool}"
                                    Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportTool}">
                                    <ic:SymbolIcon FontSize="12" Symbol="WrenchScrewdriver" />
                                </Grid>
                                <Grid
                                    Width="24"
                                    Height="24"
                                    Margin="0,0,8,0"
                                    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                    CornerRadius="{StaticResource ControlCornerRadius}"
                                    ToolTipService.ToolTip="{ext:Locale Name=SupportVision}"
                                    Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportVision}">
                                    <ic:SymbolIcon FontSize="12" Symbol="EyeTracking" />
                                </Grid>
                                <Grid
                                    Width="24"
                                    Height="24"
                                    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                    CornerRadius="{StaticResource ControlCornerRadius}"
                                    ToolTipService.ToolTip="{ext:Locale Name=SupportFileUpload}"
                                    Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportFileUpload}">
                                    <ic:SymbolIcon FontSize="12" Symbol="CloudArrowUp" />
                                </Grid>
                            </StackPanel>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="PredefinedChatModelCardStyle" TargetType="local:ChatModelCard">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ChatModelCard">
                    <Grid
                        Padding="16,8,8,8"
                        Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                        CornerRadius="{StaticResource ControlCornerRadius}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid ColumnSpacing="12">
                            <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" />
                            <StackPanel
                                Grid.Column="1"
                                Margin="0,0,-8,0"
                                VerticalAlignment="Center"
                                Orientation="Horizontal">
                                <Grid
                                    Width="24"
                                    Height="24"
                                    Margin="0,0,8,0"
                                    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                    CornerRadius="{StaticResource ControlCornerRadius}"
                                    ToolTipService.ToolTip="{ext:Locale Name=SupportTool}"
                                    Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportTool}">
                                    <ic:SymbolIcon FontSize="12" Symbol="WrenchScrewdriver" />
                                </Grid>
                                <Grid
                                    Width="24"
                                    Height="24"
                                    Margin="0,0,8,0"
                                    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                    CornerRadius="{StaticResource ControlCornerRadius}"
                                    ToolTipService.ToolTip="{ext:Locale Name=SupportVision}"
                                    Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportVision}">
                                    <ic:SymbolIcon FontSize="12" Symbol="EyeTracking" />
                                </Grid>
                                <Grid
                                    Width="24"
                                    Height="24"
                                    Margin="0,0,8,0"
                                    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                    CornerRadius="{StaticResource ControlCornerRadius}"
                                    ToolTipService.ToolTip="{ext:Locale Name=SupportFileUpload}"
                                    Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportFileUpload}">
                                    <ic:SymbolIcon FontSize="12" Symbol="CloudArrowUp" />
                                </Grid>
                            </StackPanel>
                        </Grid>

                        <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="SessionChatModelCardStyle" TargetType="local:ChatModelCard">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ChatModelCard">
                    <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">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBlock
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                                TextTrimming="CharacterEllipsis" />
                            <StackPanel
                                Grid.Column="1"
                                Margin="0,0,-8,0"
                                VerticalAlignment="Center"
                                Orientation="Horizontal">
                                <Grid
                                    Width="24"
                                    Height="24"
                                    Margin="0,0,8,0"
                                    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                    CornerRadius="{StaticResource ControlCornerRadius}"
                                    ToolTipService.ToolTip="{ext:Locale Name=SupportTool}"
                                    Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportTool}">
                                    <ic:SymbolIcon FontSize="12" Symbol="WrenchScrewdriver" />
                                </Grid>
                                <Grid
                                    Width="24"
                                    Height="24"
                                    Margin="0,0,8,0"
                                    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                    CornerRadius="{StaticResource ControlCornerRadius}"
                                    ToolTipService.ToolTip="{ext:Locale Name=SupportVision}"
                                    Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportVision}">
                                    <ic:SymbolIcon FontSize="12" Symbol="EyeTracking" />
                                </Grid>
                                <Grid
                                    Width="24"
                                    Height="24"
                                    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                    CornerRadius="{StaticResource ControlCornerRadius}"
                                    ToolTipService.ToolTip="{ext:Locale Name=SupportFileUpload}"
                                    Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportFileUpload}">
                                    <ic:SymbolIcon FontSize="12" Symbol="CloudArrowUp" />
                                </Grid>
                            </StackPanel>
                        </Grid>
                    </controls:CardPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SelectionChatModelCardStyle" TargetType="local:ChatModelCard">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ChatModelCard">
                    <Grid Padding="8,4" ColumnSpacing="8">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <TextBlock
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                            TextTrimming="CharacterEllipsis" />
                        <StackPanel
                            Grid.Column="1"
                            Margin="0,0,-8,0"
                            VerticalAlignment="Center"
                            Orientation="Horizontal">
                            <Grid
                                Width="24"
                                Height="24"
                                Margin="0,0,8,0"
                                Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                CornerRadius="{StaticResource ControlCornerRadius}"
                                ToolTipService.ToolTip="{ext:Locale Name=SupportTool}"
                                Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportTool}">
                                <ic:SymbolIcon FontSize="12" Symbol="WrenchScrewdriver" />
                            </Grid>
                            <Grid
                                Width="24"
                                Height="24"
                                Margin="0,0,8,0"
                                Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                CornerRadius="{StaticResource ControlCornerRadius}"
                                ToolTipService.ToolTip="{ext:Locale Name=SupportVision}"
                                Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportVision}">
                                <ic:SymbolIcon FontSize="12" Symbol="EyeTracking" />
                            </Grid>
                            <Grid
                                Width="24"
                                Height="24"
                                Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                CornerRadius="{StaticResource ControlCornerRadius}"
                                ToolTipService.ToolTip="{ext:Locale Name=SupportFileUpload}"
                                Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSupportFileUpload}">
                                <ic:SymbolIcon FontSize="12" Symbol="CloudArrowUp" />
                            </Grid>
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
