<?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:ic="using:FluentIcons.WinUI"
    xmlns:local="using:RodelAgent.UI.Controls.Items">

    <Style TargetType="local:AudioServiceItemControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:AudioServiceItemControl">
                    <controls:CardPanel
                        x:Name="RootCard"
                        Height="48"
                        HorizontalAlignment="Stretch"
                        HorizontalContentAlignment="Stretch"
                        AutomationProperties.Name="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                        ToolTipService.ToolTip="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}">
                        <Grid Margin="12,8" ColumnSpacing="8">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <controls:ProviderLogo
                                Height="20"
                                MaxWidth="140"
                                HorizontalAlignment="Left"
                                Provider="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.ProviderType}" />
                            <ic:SymbolIcon
                                Grid.Column="1"
                                VerticalAlignment="Center"
                                FontSize="14"
                                Foreground="{ThemeResource SystemFillColorSuccessBrush}"
                                IconVariant="Filled"
                                Symbol="CheckmarkCircle"
                                Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsCompleted}" />
                        </Grid>
                    </controls:CardPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="AvailableAudioServiceStyle" TargetType="local:AudioServiceItemControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:AudioServiceItemControl">
                    <controls:CardPanel
                        x:Name="RootCard"
                        HorizontalAlignment="Stretch"
                        HorizontalContentAlignment="Stretch"
                        AutomationProperties.Name="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                        Background="Transparent"
                        BorderBrush="Transparent"
                        IsChecked="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.IsSelected}">
                        <Grid Margin="12,8" ColumnSpacing="12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <controls:ProviderLogo
                                Width="28"
                                Height="28"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                IsAvatar="True"
                                Provider="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.ProviderType}" />
                            <TextBlock
                                Grid.Column="1"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                MaxLines="1"
                                Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                                TextTrimming="CharacterEllipsis" />
                        </Grid>
                    </controls:CardPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SelectionAudioServiceStyle" TargetType="local:AudioServiceItemControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:AudioServiceItemControl">
                    <Grid Padding="4" ColumnSpacing="8">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <controls:ProviderLogo
                            Width="20"
                            Height="20"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            AvatarPadding="3"
                            IsAvatar="True"
                            Provider="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.ProviderType}" />
                        <TextBlock
                            Grid.Column="1"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            MaxLines="1"
                            Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ViewModel.Name}"
                            TextTrimming="CharacterEllipsis" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
