<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:m="using:SourceGit.Models"
             xmlns:c="using:SourceGit.Converters"
             xmlns:vm="using:SourceGit.ViewModels"
             xmlns:v="using:SourceGit.Views"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="SourceGit.Views.EditRepositoryNode"
             x:DataType="vm:EditRepositoryNode">
  <StackPanel Orientation="Vertical" Margin="8,0,0,0">
    <StackPanel Orientation="Horizontal">
      <Path Width="16" Height="16"
            Margin="0,0,8,0"
            Data="{StaticResource Icons.Edit}"/>

      <TextBlock FontSize="18"
                 Classes="bold"
                 Text="{DynamicResource Text.EditRepositoryNode.TitleForGroup}"
                 IsVisible="{Binding !IsRepository}"/>

      <TextBlock FontSize="18"
                 Classes="bold"
                 Text="{DynamicResource Text.EditRepositoryNode.TitleForRepository}"
                 IsVisible="{Binding IsRepository}"/>
    </StackPanel>

    <Grid Height="28" Margin="8,16,0,0" ColumnDefinitions="120,*" >
      <TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,8,0" Text="{DynamicResource Text.EditRepositoryNode.Target}"/>
      <TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Name, Mode=OneTime}" IsVisible="{Binding !IsRepository}"/>
      <TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Id, Mode=TwoWay}" IsVisible="{Binding IsRepository}"/>
    </Grid>
    <Grid Height="28" Margin="8,4,0,0" ColumnDefinitions="120,*">
      <TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.EditRepositoryNode.Name}"/>
      <TextBox Grid.Column="1" CornerRadius="3" Text="{Binding Name, Mode=TwoWay}" v:AutoFocusBehaviour.IsEnabled="True"/>
    </Grid>
    <Grid Height="28" Margin="8,4,0,0" ColumnDefinitions="120,*" IsVisible="{Binding IsRepository}">
      <TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.EditRepositoryNode.Bookmark}"/>
      <ComboBox Grid.Column="1"
                BorderThickness="0"
                Height="28"
                ItemsSource="{Binding Bookmarks}"
                SelectedIndex="{Binding Bookmark, Mode=TwoWay}">
        <ComboBox.ItemTemplate>
          <DataTemplate>
            <Grid Height="20">
              <Path Width="12" Height="12"
                    Fill="{Binding Converter={x:Static c:IntConverters.ToBookmarkBrush}}"
                    HorizontalAlignment="Center" VerticalAlignment="Center"
                    Data="{StaticResource Icons.Bookmark}"/>
            </Grid>
          </DataTemplate>
        </ComboBox.ItemTemplate>
      </ComboBox>
    </Grid>
  </StackPanel>
</UserControl>
