<?xml version="1.0" encoding="utf-8" ?>
<local:DrawSessionControlBase
    x:Class="RodelAgent.UI.Controls.Draw.DrawSessionPresenter"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:RodelAgent.UI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:RodelAgent.UI.Extensions"
    xmlns:ic="using:FluentIcons.WinUI"
    xmlns:local="using:RodelAgent.UI.Controls.Draw"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid MaxWidth="1024" RowSpacing="8">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid
            Padding="20"
            Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
            CornerRadius="{StaticResource OverlayCornerRadius}"
            RowSpacing="12">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="12" />
            </Grid.RowDefinitions>
            <controls:ImageEx
                x:Name="DisplayImage"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                CornerRadius="{StaticResource OverlayCornerRadius}"
                SizeChanged="OnImageSizeChanged"
                Source="{x:Bind ViewModel.ImagePath, Mode=OneWay}"
                Stretch="UniformToFill" />
            <ScrollViewer
                Grid.Row="1"
                HorizontalScrollBarVisibility="Hidden"
                HorizontalScrollMode="Auto"
                VerticalScrollBarVisibility="Hidden"
                VerticalScrollMode="Disabled">
                <StackPanel Orientation="Horizontal" Spacing="8">
                    <Button x:Name="SaveAsButton" Command="{x:Bind ViewModel.SaveImageCommand, Mode=OneWay}">
                        <StackPanel Orientation="Horizontal" Spacing="8">
                            <ic:SymbolIcon
                                VerticalAlignment="Center"
                                FontSize="12"
                                Symbol="Save" />
                            <TextBlock
                                VerticalAlignment="Center"
                                Style="{StaticResource CaptionTextBlockStyle}"
                                Text="{ext:Locale Name=SaveAs}" />
                        </StackPanel>
                    </Button>
                    <Button x:Name="CopyButton" Command="{x:Bind ViewModel.CopyImageCommand, Mode=OneWay}">
                        <StackPanel Orientation="Horizontal" Spacing="8">
                            <ic:SymbolIcon
                                VerticalAlignment="Center"
                                FontSize="12"
                                Symbol="Copy" />
                            <TextBlock
                                VerticalAlignment="Center"
                                Style="{StaticResource CaptionTextBlockStyle}"
                                Text="{ext:Locale Name=CopyImage}" />
                        </StackPanel>
                    </Button>
                    <Button x:Name="OpenImageButton" Command="{x:Bind ViewModel.OpenImageCommand, Mode=OneWay}">
                        <StackPanel Orientation="Horizontal" Spacing="8">
                            <ic:SymbolIcon
                                VerticalAlignment="Center"
                                FontSize="12"
                                Symbol="Image" />
                            <TextBlock
                                VerticalAlignment="Center"
                                Style="{StaticResource CaptionTextBlockStyle}"
                                Text="{ext:Locale Name=OpenImage}" />
                        </StackPanel>
                    </Button>
                </StackPanel>
            </ScrollViewer>
        </Grid>

        <controls:ProviderLogo
            Grid.RowSpan="2"
            Width="48"
            Height="48"
            Margin="20,0,0,0"
            HorizontalAlignment="Left"
            VerticalAlignment="Bottom"
            AvatarPadding="12"
            CornerRadius="{StaticResource OverlayCornerRadius}"
            IsAvatar="True"
            Provider="{x:Bind ViewModel.DrawService.ProviderType, Mode=OneWay}" />

        <TextBlock
            Grid.Row="1"
            HorizontalAlignment="Right"
            Foreground="{ThemeResource TextFillColorDisabledBrush}"
            Style="{StaticResource CaptionTextBlockStyle}"
            Text="{x:Bind ViewModel.LastGenerateTime}" />
    </Grid>

</local:DrawSessionControlBase>
