<UserControl x:Class="Artemis.UI.Screens.Settings.Dialogs.UpdateDialogView"
             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:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:s="https://github.com/canton7/Stylet"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">
    <StackPanel Margin="16">
        <TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}" TextWrapping="Wrap" Margin="0 0 0 20">
            Update available
        </TextBlock>
        <TextBlock Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
                   Foreground="{DynamicResource MaterialDesignBodyLight}"
                   TextWrapping="Wrap">
            A new Artemis update is available! 🥳<LineBreak />
            You are currently running build <Run Text="{Binding CurrentBuild, Mode=OneWay}" /> while the latest build is <Run Text="{Binding LatestBuild, Mode=OneWay}" />. <LineBreak /> <LineBreak />
            Updating Artemis will give you the latest bug(fixes), features and improvements.
        </TextBlock>

        <TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}" TextWrapping="Wrap" Margin="0 20">
            Changes
        </TextBlock>

        <StackPanel Visibility="{Binding RetrievingChanges, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
            <TextBlock Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
                       Foreground="{DynamicResource MaterialDesignBodyLight}"
                       HorizontalAlignment="Center"
                       Margin="0 10">
                Retrieving changes...
            </TextBlock>
            <ProgressBar IsIndeterminate="True" />
        </StackPanel>

        <Grid Visibility="{Binding RetrievingChanges, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}">
            <ScrollViewer MaxHeight="400" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto">
                <ItemsControl ItemsSource="{Binding Changes}" Visibility="{Binding HasChanges, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" Style="{StaticResource MaterialDesignSubtitle1TextBlock}" Foreground="{DynamicResource MaterialDesignBodyLight}" />
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>
            <TextBlock Visibility="{Binding HasChanges, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}"
                       Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
                       Foreground="{DynamicResource MaterialDesignBodyLight}">
                Couldn't retrieve changes, sorry :(
            </TextBlock>
        </Grid>

        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 8 0 0">
            <Button Style="{StaticResource MaterialDesignFlatButton}"
                    Focusable="False"
                    IsCancel="True"
                    Command="{s:Action Cancel}"
                    Content="LATER" />
            <Button x:Name="ConfirmButton"
                    Style="{StaticResource MaterialDesignFlatButton}"
                    IsDefault="True"
                    Focusable="True"
                    Command="{s:Action Update}"
                    Content="UPDATE" />
        </StackPanel>

    </StackPanel>
</UserControl>