<UserControl x:Class="UniGetUI.Avalonia.Views.Pages.AboutPages.ThirdPartyLicenses"
             xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:automation="clr-namespace:Avalonia.Automation;assembly=Avalonia.Controls"
             xmlns:vm="using:UniGetUI.Avalonia.ViewModels.Pages.AboutPages"
             xmlns:t="using:UniGetUI.Avalonia.MarkupExtensions"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:DataType="vm:ThirdPartyLicensesViewModel">

    <ScrollViewer HorizontalScrollBarVisibility="Disabled">
        <StackPanel Orientation="Vertical" Spacing="4" Margin="16,8">

            <TextBlock Text="{t:Translate UniGetUI License}"
                       FontFamily="Segoe UI Variable Display"
                       FontSize="24"
                       FontWeight="Bold"/>

            <TextBlock Text="{t:Translate Text='Using UniGetUI implies the acceptation of the MIT License'}"
                       FontSize="14"
                       TextWrapping="Wrap"/>

            <TextBlock Text="{t:Translate Third-party licenses}"
                       FontFamily="Segoe UI Variable Display"
                       FontSize="24"
                       FontWeight="Bold"
                       Margin="0,10,0,0"/>

            <TextBlock Text="{Binding LicensesIntro}"
                       FontSize="14"
                       TextWrapping="Wrap"
                       Margin="0,0,0,8"/>

            <ItemsControl ItemsSource="{Binding Licenses}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate x:DataType="vm:LibraryLicense">
                        <Grid ColumnDefinitions="140,*,240"
                              Margin="0,2">
                            <TextBlock Grid.Column="0"
                                       Text="{Binding Name}"
                                       FontSize="14"
                                       VerticalAlignment="Center"/>
                            <Button Grid.Column="1"
                                    Tag="{Binding LicenseURL}"
                                    Click="LicenseButton_Click"
                                    Background="Transparent"
                                    BorderThickness="0"
                                    Padding="4,0"
                                    HorizontalAlignment="Center"
                                    automation:AutomationProperties.Name="{Binding License}">
                                <TextBlock Classes="hyperlink"
                                           FontSize="14"
                                           Text="{Binding License}"
                                           automation:AutomationProperties.AccessibilityView="Raw"/>
                            </Button>
                            <Button Grid.Column="2"
                                    Tag="{Binding HomepageUrl}"
                                    Click="HomepageButton_Click"
                                    Background="Transparent"
                                    BorderThickness="0"
                                    Padding="4,0"
                                    HorizontalAlignment="Right"
                                    automation:AutomationProperties.Name="{Binding HomepageText}">
                                <TextBlock Classes="hyperlink"
                                           FontSize="14"
                                           Text="{Binding HomepageText}"
                                           automation:AutomationProperties.AccessibilityView="Raw"/>
                            </Button>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

        </StackPanel>
    </ScrollViewer>

</UserControl>
