<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vm="using:ZB.MOM.WW.OtOpcUa.Client.UI.ViewModels"
             x:Class="ZB.MOM.WW.OtOpcUa.Client.UI.Views.ReadWriteView"
             x:DataType="vm:ReadWriteViewModel">
    <StackPanel Spacing="8" Margin="8">
        <!-- Selected Node -->
        <TextBlock Text="Selected Node" FontWeight="Bold" />
        <TextBlock Text="{Binding SelectedNodeId, FallbackValue='(none)'}"
                   Foreground="Gray" />

        <!-- Read Section -->
        <Separator />
        <TextBlock Text="Read Value" FontWeight="Bold" />
        <Button Content="Read" Command="{Binding ReadCommand}" />
        <Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto,Auto,Auto" Margin="0,4,0,0">
            <TextBlock Grid.Row="0" Grid.Column="0" Text="Value: " FontWeight="SemiBold" />
            <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding CurrentValue}" TextWrapping="Wrap" />

            <TextBlock Grid.Row="1" Grid.Column="0" Text="Status: " FontWeight="SemiBold" />
            <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding CurrentStatus}" />

            <TextBlock Grid.Row="2" Grid.Column="0" Text="Source Time: " FontWeight="SemiBold" />
            <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding SourceTimestamp}" />

            <TextBlock Grid.Row="3" Grid.Column="0" Text="Server Time: " FontWeight="SemiBold" />
            <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding ServerTimestamp}" />
        </Grid>

        <!-- Write Section -->
        <Separator />
        <TextBlock Text="Write Value" FontWeight="Bold" />
        <StackPanel Orientation="Horizontal" Spacing="8">
            <TextBox Text="{Binding WriteValue}" Width="200" Watermark="Value to write" />
            <Button Content="Write" Command="{Binding WriteCommand}" />
        </StackPanel>
        <TextBlock Text="{Binding WriteStatus}" Foreground="Gray" />
    </StackPanel>
</UserControl>