<UserControl x:Class="DesktopMagic.Plugins.ModEntry"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:DesktopMagic.Plugins"
             xmlns:dataContext="clr-namespace:DesktopMagic.DataContexts"
             d:DataContext="{d:DesignInstance Type=dataContext:PluginEntryDataContext}"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800"
             Background="{DynamicResource MaterialDesignPaper}"
             FontFamily="{DynamicResource MaterialDesignFont}"
             Visibility="{Binding Visibility}">
    <ui:Card Padding="5">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="2*" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            
            <Image Width="100" Height="100" Margin="5" Source="{Binding Logo, FallbackValue={StaticResource ModioCogBlue}, TargetNullValue={StaticResource ModioCogBlue}}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />

            <StackPanel Grid.Column="1" VerticalAlignment="Center">
                <Label Content="{Binding Author, Converter={StaticResource UnderscoreEscapingConverter}}" HorizontalAlignment="Center" ContentStringFormat="{DynamicResource authorFormat}" />
                <Label Content="{Binding DateAdded}" HorizontalAlignment="Center" ContentStringFormat="{DynamicResource addedFormat}" />
                <Label Content="{Binding DateUpdated}" HorizontalAlignment="Center" ContentStringFormat="{DynamicResource updatedFormat}" />
                <Label Content="{Binding Version}" HorizontalAlignment="Center" ContentStringFormat="{DynamicResource versionFormat}" />
            </StackPanel>

            <Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="0 5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Button Grid.Column="0" Command="{Binding InstallUninstallButtonData.Command}" IsEnabled="{Binding InstallUninstallButtonData.IsEnabled}" VerticalAlignment="Bottom" HorizontalAlignment="Stretch">
                    <StackPanel Orientation="Horizontal">
                        <ui:SymbolIcon Symbol="Delete24" Margin="0 0 10 0" />
                        <TextBlock Text="{Binding InstallUninstallButtonData.Text}" />
                    </StackPanel>
                </Button>
                <Button Grid.Column="1" Command="{Binding OpenButtonData.Command}" IsEnabled="{Binding OpenButtonData.IsEnabled}" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="5 0 5 0">
                    <StackPanel Orientation="Horizontal">
                        <ui:SymbolIcon Symbol="{Binding OpenButtonData.Icon}" Margin="0 0 10 0" />
                        <TextBlock Text="{Binding OpenButtonData.Text}" />
                    </StackPanel>
                </Button>
            </Grid>

            <StackPanel Grid.Row="2" Grid.ColumnSpan="2" Margin="5">
                <ui:TextBlock Text="{Binding Name, Converter={StaticResource UnderscoreEscapingConverter}}" FontTypography="Title" Padding="0" Margin="0 0 0 5" />
                <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="0" />
            </StackPanel>
        </Grid>
    </ui:Card>
</UserControl>