<Window xmlns="https://github.com/avaloniaui"
        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"
        xmlns:vm="using:ClawdDotNet.Desktop.ViewModels"
        mc:Ignorable="d" d:DesignWidth="450" d:DesignHeight="350"
        Width="480" Height="360"
        Padding="16"
        WindowStartupLocation="CenterOwner"
        CanResize="False"
        Title="Dienst (Service) hinzufügen"
        x:Class="ClawdDotNet.Desktop.Views.AddServiceWindow"
        x:DataType="vm:AddServiceViewModel">

  <DockPanel>

    <!-- Bottom Buttons -->
    <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="8" Margin="0,16,0,0">
      <Button Content="Abbrechen" Command="{Binding CancelCommand}" />
      <Button Content="Hinzufügen" Command="{Binding ConfirmCommand}" Classes="accent" />
    </StackPanel>

    <TextBlock DockPanel.Dock="Bottom" Text="{Binding StatusMessage}" Foreground="Red" Margin="0,8,0,0" />

    <StackPanel Spacing="12">

      <StackPanel Spacing="4">
        <TextBlock Text="Name des Dienstes:" FontWeight="Bold" />
        <TextBox Text="{Binding ServiceName}" PlaceholderText="z.B. WebHookService" />
      </StackPanel>

      <Grid ColumnDefinitions="*,*" RowDefinitions="Auto,Auto">
        <StackPanel Grid.Column="0" Spacing="4" Margin="0,0,4,0">
          <TextBlock Text="Typ:" FontWeight="Bold" />
          <ComboBox ItemsSource="{Binding AvailableServiceTypes}" SelectedItem="{Binding ServiceType}" HorizontalAlignment="Stretch" />
        </StackPanel>

        <StackPanel Grid.Column="1" Spacing="4" Margin="4,0,0,0">
          <TextBlock Text="Port:" FontWeight="Bold" />
          <NumericUpDown Value="{Binding ServicePort}" Minimum="1" Maximum="65535" FormatString="0" />
        </StackPanel>
      </Grid>

      <StackPanel Spacing="4">
        <TextBlock Text="Beschreibung:" FontWeight="Bold" />
        <TextBox Text="{Binding ServiceDescription}" PlaceholderText="Optionale Beschreibung..." AcceptsReturn="True" Height="60" />
      </StackPanel>

    </StackPanel>

  </DockPanel>

</Window>
