<UserControl
    x:Class="Pixeval.Controls.CommentItem"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:CommunityToolkit.WinUI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:fluent="using:FluentIcons.WinUI"
    xmlns:local="using:Pixeval.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pixeval="using:Pixeval.AppManagement"
    mc:Ignorable="d">
    <controls:DockPanel HorizontalSpacing="10" VerticalSpacing="5">
        <controls:SwitchPresenter
            Margin="57,0,0,0"
            controls:DockPanel.Dock="Bottom"
            Value="{x:Bind ViewModel.IsStamp, Mode=OneWay}">
            <controls:Case>
                <controls:Case.Value>
                    <x:Boolean>True</x:Boolean>
                </controls:Case.Value>
                <local:LazyImage
                    x:Name="StickerImageContent"
                    MaxHeight="100"
                    HorizontalAlignment="Left"
                    Stretch="Uniform" />
            </controls:Case>
            <controls:Case>
                <controls:Case.Value>
                    <x:Boolean>False</x:Boolean>
                </controls:Case.Value>
                <local:TranslatableTextBlock
                    x:Name="CommentContent"
                    HorizontalButtonAlignment="Left"
                    TextType="Comment"
                    UseMarkdown="True" />
            </controls:Case>
        </controls:SwitchPresenter>
        <CommandBar
            controls:DockPanel.Dock="Right"
            DefaultLabelPosition="Right"
            OverflowButtonVisibility="Collapsed">
            <AppBarButton
                Click="DeleteReplyButton_OnClicked"
                Icon="{fluent:SymbolIcon Symbol=Delete}"
                LabelPosition="Collapsed"
                Visibility="{x:Bind local:C.ToVisibility(ViewModel.IsMe), Mode=OneWay}" />
            <AppBarButton
                Click="OpenRepliesButton_OnClicked"
                Icon="{fluent:SymbolIcon Symbol=Chat}"
                Label="{x:Bind ViewModel.RepliesCount, Mode=OneWay}"
                LabelPosition="{x:Bind local:C.LabelIsNullToVisibility(ViewModel.RepliesCount), Mode=OneWay}" />
        </CommandBar>
        <Button
            HorizontalAlignment="Stretch"
            HorizontalContentAlignment="Left"
            Background="Transparent"
            BorderThickness="0"
            Click="PosterPersonPicture_OnClicked">
            <controls:DockPanel HorizontalSpacing="10" LastChildFill="False">
                <PersonPicture
                    Width="35"
                    Height="35"
                    controls:DockPanel.Dock="Left"
                    ProfilePicture="{x:Bind ViewModel.AvatarSource, Mode=OneWay}" />
                <TextBlock
                    controls:DockPanel.Dock="Top"
                    Style="{StaticResource CaptionTextBlockStyle}"
                    Text="{x:Bind ViewModel.Poster, Mode=OneWay}" />
                <!--  TipTextColor  -->
                <TextBlock
                    controls:DockPanel.Dock="Bottom"
                    Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                    Style="{StaticResource CaptionTextBlockStyle}"
                    Text="{x:Bind local:C.CultureDateTimeOffsetDateFormatter(ViewModel.PostDate, pixeval:AppSettings.CurrentCulture), Mode=OneWay}" />
            </controls:DockPanel>
        </Button>
    </controls:DockPanel>
</UserControl>
