<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:c="using:SourceGit.Converters"
             xmlns:vm="using:SourceGit.ViewModels"
             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,Auto,*" >
      <TextBlock Grid.Column="0"
                 HorizontalAlignment="Right" VerticalAlignment="Center"
                 Margin="0,0,8,0"
                 Text="{DynamicResource Text.EditRepositoryNode.Target}"/>
      
      <Path Grid.Column="1"
            Width="12" Height="12"
            Margin="0,1,0,0"
            Data="{StaticResource Icons.Folder.Open}"
            IsVisible="{Binding !IsRepository, Mode=OneWay}"/>
      <Path Grid.Column="1"
            Width="12" Height="12"
            Data="{StaticResource Icons.Repositories}"
            IsVisible="{Binding IsRepository, Mode=OneWay}"/>
      
      <TextBlock Grid.Column="2"
                 Margin="6,0,0,0"
                 VerticalAlignment="Center"
                 Text="{Binding Target, Mode=OneWay}"/>
    </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}"/>
    </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>
