<UserControl 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:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             xmlns:vm="clr-namespace:PSCHelpdesk.Plugins.HetznerServer.ViewModels"
             xmlns:views="clr-namespace:PSCHelpdesk.Plugins.HetznerServer.Views"
             x:Class="PSCHelpdesk.Plugins.HetznerServer.Views.ServerDetailView">
    <StackPanel>
        <TextBlock Text="{Binding SelectedServer.Name}" FontSize="24"/>
        <TabControl>
            <TabItem Header="Domains">
                <StackPanel>
                    <ListBox ItemsSource="{Binding SelectedServer.Domains}" Margin="0" Padding="0">
                        <ListBox.Styles> 
                            <Style Selector="ListBoxItem">
                                <Setter Property="Padding" Value="0" />
                            </Style> 
                        </ListBox.Styles>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Border Padding="1" Margin="0">
                                    <HyperlinkButton Content="{Binding LinkDomain}" NavigateUri="{Binding LinkDomain}"></HyperlinkButton>
                                </Border>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
            </TabItem>
            <TabItem Header="Info">
                <Grid ColumnDefinitions="Auto,*" RowDefinitions="*,*,*,*">
                    <TextBlock Grid.Row="0" Grid.Column="0" Padding="0 6 6 0" Text="SftpUserName"></TextBlock>
                    <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding SelectedServer.Instance.SftpUserName}"></TextBox>
                    <TextBlock Grid.Row="1" Grid.Column="0" Padding="0 6 6 0" Text="SftpPassword"></TextBlock>
                    <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectedServer.Instance.SftpPassword}"></TextBox>
                    <TextBlock Grid.Row="2" Grid.Column="0" Padding="0 6 6 0" Text="SftpHostName"></TextBlock>
                    <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectedServer.Instance.SftpHostName}"></TextBox>
                    <TextBlock Grid.Row="3" Grid.Column="0" Padding="0 6 6 0" Text="SftpSmtpOwn"></TextBlock>
                    <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding SelectedServer.Instance.SmtpOwn}"></TextBox>
                </Grid>
            </TabItem>
            <TabItem Header="Plugins">
                <StackPanel>
                    <ListBox ItemsSource="{Binding SelectedServer.Plugins}" Margin="0" Padding="0">
                        <ListBox.Styles> 
                            <Style Selector="ListBoxItem">
                                <Setter Property="Padding" Value="0" />
                            </Style> 
                        </ListBox.Styles>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Border Padding="1" Margin="0">
                                    <Grid ColumnDefinitions="Auto,*">
                                        <materialIcons:MaterialIcon Grid.Column="0" Kind="{Binding Icon }" Margin="5 0"></materialIcons:MaterialIcon>
                                        <TextBox Grid.Column="1" Text="{Binding Title}"></TextBox>
                                    </Grid>
                                </Border>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
            </TabItem>
            <TabItem Header="Settings">
                <StackPanel>
                    <TextBlock Text="PSC ApiKey" Margin="0 5"></TextBlock>
                    <TextBox Text="{Binding SelectedServer.PscApiKey}"></TextBox>
                    <TextBlock Text="FastBill Id" Margin="0 5"></TextBlock>
                    <TextBox Text="{Binding SelectedServer.FastBillId}"></TextBox>
                    <TextBlock Text="FastBill Nr" Margin="0 5"></TextBlock>
                    <TextBox Text="{Binding SelectedServer.FastBillNr}"></TextBox>
                    <Button Content="Save" Command="{Binding SaveServerSettings}"></Button>
                </StackPanel>
            </TabItem>
        </TabControl>
    </StackPanel>
</UserControl>
