<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.SubscriptionsView"
             x:DataType="vm:SubscriptionsViewModel">
    <DockPanel Margin="8">
        <!-- Add/Remove Controls -->
        <StackPanel DockPanel.Dock="Top" Spacing="8">
            <TextBlock Text="Subscriptions" FontWeight="Bold" />
            <StackPanel Orientation="Horizontal" Spacing="8">
                <TextBox Text="{Binding NewNodeIdText}" Width="250" Watermark="Node ID (e.g., ns=2;s=MyNode)" />
                <NumericUpDown Value="{Binding NewInterval}" Minimum="100" Maximum="60000" Width="120" />
                <Button Content="Add" Command="{Binding AddSubscriptionCommand}" />
                <Button Content="Remove" Command="{Binding RemoveSubscriptionCommand}" />
            </StackPanel>
        </StackPanel>

        <!-- Active Subscriptions List -->
        <DataGrid Name="SubscriptionsGrid"
                  ItemsSource="{Binding ActiveSubscriptions}"
                  SelectedItem="{Binding SelectedSubscription}"
                  SelectionMode="Extended"
                  AutoGenerateColumns="False"
                  IsReadOnly="True"
                  HorizontalScrollBarVisibility="Auto"
                  Margin="0,8,0,0">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Node ID" Binding="{Binding NodeId}" Width="Auto" />
                <DataGridTextColumn Header="Value" Binding="{Binding Value}" Width="Auto" />
                <DataGridTextColumn Header="Status" Binding="{Binding Status}" Width="Auto" />
                <DataGridTextColumn Header="Timestamp" Binding="{Binding Timestamp}" Width="Auto" />
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</UserControl>