<UserControl x:Class="CtrEditor.ObjetosSim.HydraulicComponents.ucHydPump"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
             xmlns:vm="clr-namespace:CtrEditor.ObjetosSim.HydraulicComponents"
             mc:Ignorable="d">

    <UserControl.DataContext>
        <vm:osHydPump Ancho="0.15" Alto="0.10"/>
    </UserControl.DataContext>

    <Canvas RenderTransformOrigin="0,0">
        <Canvas.RenderTransform>
            <TransformGroup>
                <ScaleTransform />
                <SkewTransform />
                <RotateTransform Angle="{Binding Angulo}" />
                <TranslateTransform />
            </TransformGroup>
        </Canvas.RenderTransform>

        <!-- Fondo de la bomba -->
        <Ellipse x:Name="PumpBackground" 
                 Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}"
                 Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"
                 Fill="{Binding ColorButton_oculto}" 
                 Stroke="DarkSlateGray" 
                 StrokeThickness="2"/>
        <!-- Indicador de dirección con tamaño proporcional -->
        <Polygon x:Name="DirectionArrow" 
                 Fill="DarkBlue" 
                 Points="0.5,0.3 0.8,0.5 0.5,0.7" 
                 RenderTransformOrigin="0.5,0.5">
            <Polygon.RenderTransform>
                <ScaleTransform ScaleX="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}" 
                               ScaleY="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"/>
            </Polygon.RenderTransform>
        </Polygon>
        
        <!-- Texto de identificación con Viewbox para escalado -->
        <Viewbox Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}"
                 Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}" 
                 Stretch="Uniform">
            <Label Content="{Binding Nombre}" 
                   VerticalAlignment="Center" 
                   HorizontalAlignment="Center" 
                   FontWeight="Bold"
                   FontSize="18" 
                   Opacity="0.9" 
                   Foreground="White"/>
        </Viewbox>
        
        <!-- Indicador de estado (LED) con posición proporcional -->
        <Ellipse x:Name="StatusLED" 
                 Width="8" 
                 Height="8" 
                 Fill="{Binding IsRunning, Converter={StaticResource BoolToColorConverter}}" 
                 Canvas.Right="5" 
                 Canvas.Top="5"/>
        
        <!-- Conexiones de entrada y salida con posiciones proporcionales -->
        <Rectangle x:Name="InletConnection" 
                   Width="10" 
                   Height="4" 
                   Fill="Green" 
                   Canvas.Left="-5" 
                   Canvas.Top="{Binding Alto, Converter={StaticResource MeterToPixelConverter}, ConverterParameter=0.5}"/>
        
        <Rectangle x:Name="OutletConnection" 
                   Width="10" 
                   Height="4" 
                   Fill="Red" 
                   Canvas.Right="-5" 
                   Canvas.Top="{Binding Alto, Converter={StaticResource MeterToPixelConverter}, ConverterParameter=0.5}"/>
        
    </Canvas>
</UserControl>
