<local:CenterPopup
    x:Class="Bili.App.Controls.CoverDownloaderView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:loc="using:Bili.App.Resources.Extension"
    xmlns:local="using:Bili.App.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    Title="{loc:Locale Name=CoverDownloader}"
    d:DesignHeight="300"
    d:DesignWidth="400"
    mc:Ignorable="d">

    <Grid RowSpacing="8">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <TextBlock
            Style="{StaticResource CaptionTextBlockStyle}"
            Foreground="{ThemeResource TextFillColorSecondaryBrush}"
            Text="{loc:Locale Name=CoverDownloaderIntroduce}"
            TextWrapping="Wrap" />
        <muxc:InfoBar
            Grid.Row="1"
            IsOpen="{x:Bind _viewModel.IsShowError, Mode=OneWay}"
            Message="{x:Bind _viewModel.ErrorMessage, Mode=OneWay}"
            Severity="Error" />
        <AutoSuggestBox
            Grid.Row="2"
            HorizontalAlignment="Stretch"
            PlaceholderText="{loc:Locale Name=AvBvId}"
            QuerySubmitted="OnIdQuerySubmitted"
            Text="{x:Bind _viewModel.InputId, Mode=TwoWay}" />
        <Grid
            Grid.Row="3"
            MinHeight="200"
            Margin="0,4"
            Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
            CornerRadius="{StaticResource ControlCornerRadius}">
            <controls:ImageEx
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Source="{x:Bind _viewModel.CoverUrl, Mode=OneWay}"
                Stretch="Uniform" />
        </Grid>
        <Button
            Style="{StaticResource AccentButtonStyle}"
            Grid.Row="4"
            HorizontalAlignment="Stretch"
            Command="{x:Bind _viewModel.DownloadCommand}"
            Content="{loc:Locale Name=SaveToPictureLibrary}" />
    </Grid>
</local:CenterPopup>
