<?xml version="1.0" encoding="utf-8" ?>
<local:UserCardControlBase
    x:Class="BiliCopilot.UI.Controls.Components.UserCardControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:base="using:Richasy.WinUIKernel.Share.Base"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:BiliCopilot.UI.Extensions"
    xmlns:ic="using:FluentIcons.WinUI"
    xmlns:local="using:BiliCopilot.UI.Controls.Components"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <base:CardControl
        x:Name="RootCard"
        BorderThickness="0"
        Command="{x:Bind ViewModel.ShowUserSpaceCommand, Mode=OneWay}">
        <Grid Padding="12,12,12,8" ColumnSpacing="16">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid VerticalAlignment="Top">
                <PersonPicture
                    Width="48"
                    Height="48"
                    DisplayName="{x:Bind ViewModel.Name, Mode=OneWay}"
                    ProfilePicture="{x:Bind ViewModel.Avatar, Mode=OneWay, Converter={StaticResource BitmapConverter}}" />
                <Image
                    Width="16"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Bottom"
                    Source="ms-appx:///Assets/vip.png"
                    Visibility="{x:Bind ViewModel.IsVip, Mode=OneWay}" />
            </Grid>
            <Grid Grid.Column="1" RowSpacing="4">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid ColumnSpacing="8">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <base:TrimTextBlock
                        FontWeight="Bold"
                        MaxLines="1"
                        Text="{x:Bind ViewModel.Name, Mode=OneWay}" />
                    <Image
                        Grid.Column="1"
                        Height="9"
                        VerticalAlignment="Center"
                        Source="{x:Bind ViewModel.Level, Converter={StaticResource LevelImageConverter}, Mode=OneWay}"
                        Visibility="{x:Bind ViewModel.Level, Converter={StaticResource ObjectToVisibilityConverter}, Mode=OneWay}" />
                </Grid>
                <base:TrimTextBlock
                    Grid.Row="1"
                    FontSize="12"
                    Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                    Text="{x:Bind ViewModel.Description, Mode=OneWay}" />
                <Grid Grid.Row="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Foreground="{ThemeResource TextFillColorDisabledBrush}"
                        IsTextSelectionEnabled="True"
                        Style="{StaticResource CaptionTextBlockStyle}"
                        Text="{x:Bind ViewModel.Id, Mode=OneWay}" />
                    <ToggleButton
                        x:Name="FollowButton"
                        Grid.Column="1"
                        Width="20"
                        Height="20"
                        Margin="0,-4,0,0"
                        Padding="0"
                        VerticalAlignment="Center"
                        HorizontalContentAlignment="Center"
                        VerticalContentAlignment="Center"
                        Command="{x:Bind ViewModel.ToggleFollowCommand, Mode=OneWay}"
                        CornerRadius="10">
                        <ic:SymbolIcon
                            x:Name="FollowIcon"
                            FontSize="10"
                            Symbol="Heart"
                            ToolTipService.ToolTip="{ext:Locale Name=Follow}" />
                    </ToggleButton>
                </Grid>
            </Grid>
        </Grid>
    </base:CardControl>
</local:UserCardControlBase>
