<?xml version="1.0" encoding="utf-8" ?>
<local:ChatServicePageControlBase
    x:Class="RodelAgent.UI.Controls.Chat.AvailableChatServiceSection"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:RodelAgent.UI.Extensions"
    xmlns:ic="using:FluentIcons.WinUI"
    xmlns:items="using:RodelAgent.UI.ViewModels.Items"
    xmlns:itemscontrol="using:RodelAgent.UI.Controls.Items"
    xmlns:local="using:RodelAgent.UI.Controls.Chat"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <StackPanel Spacing="8">
        <Grid Margin="12,0" Padding="0,4">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock
                VerticalAlignment="Center"
                Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                Style="{StaticResource CaptionTextBlockStyle}"
                Text="{ext:Locale Name=AvailableService}" />
        </Grid>
        <Grid>
            <Border
                Padding="12,8"
                BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}"
                BorderThickness="1"
                CornerRadius="{StaticResource ControlCornerRadius}"
                Visibility="{x:Bind ViewModel.IsAvailableServicesEmpty, Mode=OneWay}">
                <TextBlock
                    HorizontalAlignment="Center"
                    Foreground="{ThemeResource TextFillColorDisabledBrush}"
                    Style="{StaticResource CaptionTextBlockStyle}"
                    Text="{ext:Locale Name=NoAvailableService}"
                    TextAlignment="Center" />
            </Border>
            <Grid Visibility="{x:Bind ViewModel.IsAvailableServicesEmpty, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}">
                <ItemsRepeater ItemsSource="{x:Bind ViewModel.AvailableServices}">
                    <ItemsRepeater.ItemTemplate>
                        <DataTemplate x:DataType="items:ChatServiceItemViewModel">
                            <itemscontrol:ChatServiceItemControl
                                Click="OnServiceItemClick"
                                Style="{StaticResource AvailableServiceStyle}"
                                ViewModel="{x:Bind}" />
                        </DataTemplate>
                    </ItemsRepeater.ItemTemplate>
                    <ItemsRepeater.Layout>
                        <StackLayout Spacing="4" />
                    </ItemsRepeater.Layout>
                </ItemsRepeater>
            </Grid>
        </Grid>
    </StackPanel>
</local:ChatServicePageControlBase>
