<UserControl
    x:Class="SHH.CameraDashboard.VideoTile"
    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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DesignHeight="200"
    d:DesignWidth="300"
    mc:Ignorable="d">

    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVis" />
    </UserControl.Resources>

    <Border
        Margin="2"
        Background="Black"
        BorderBrush="#444"
        BorderThickness="1"
        CornerRadius="4">
        <Grid>
            <Image Source="{Binding DisplayImage}" Stretch="Uniform" />

            <Grid Background="#222" Visibility="{Binding IsConnected, Converter={StaticResource BoolToVis}, ConverterParameter=Inverse}">
                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                    <TextBlock
                        HorizontalAlignment="Center"
                        FontSize="24"
                        Foreground="#666"
                        Text="❌" />
                    <TextBlock
                        Margin="0,5,0,0"
                        Foreground="#666"
                        Text="无信号" />
                </StackPanel>
            </Grid>

            <Grid
                Height="28"
                VerticalAlignment="Top"
                Background="#66000000">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <TextBlock
                    Grid.Column="0"
                    Margin="8,0"
                    VerticalAlignment="Center"
                    FontWeight="Bold"
                    Foreground="White"
                    Text="{Binding CameraName}" />

                <TextBlock
                    Grid.Column="1"
                    Margin="8,0"
                    VerticalAlignment="Center"
                    FontSize="11"
                    Foreground="#00FF00"
                    Text="{Binding StatusInfo}" />
            </Grid>
        </Grid>
    </Border>
</UserControl>