@inherits MSGComponentBase
@inject MediaTranscriptionService MediaTranscriptionService
@using AIStudio.Tools.Services

@if (this.Snapshot is { IsBusy: true } snapshot)
{
    @if (this.Compact)
    {
        <MudStack Row="true" AlignItems="AlignItems.Center" Class="pa-1">
            <MudProgressCircular Size="Size.Small" Indeterminate="@(snapshot.Progress is null)" Value="@((snapshot.Progress ?? 0) * 100)"/>
            <MudText Typo="Typo.body2">
                @this.StatusText
            </MudText>
            <MudTooltip Text="@T("Stop media transcription")">
                <MudIconButton Size="Size.Small" Icon="@Icons.Material.Filled.Stop" Color="Color.Error" OnClick="@(async () => await this.MediaTranscriptionService.StopAsync(this.Owner))"/>
            </MudTooltip>
        </MudStack>
    }
    else
    {
        <MudPaper Outlined="true" Class="pa-2 mb-2">
            <MudStack Row="true" AlignItems="AlignItems.Center">
                <MudProgressCircular Size="Size.Small" Indeterminate="@(snapshot.Progress is null)" Value="@((snapshot.Progress ?? 0) * 100)"/>
                <MudText Typo="Typo.body2">
                    @this.StatusText
                </MudText>
                <MudSpacer/>
                <MudTooltip Text="@T("Stop media transcription")">
                    <MudIconButton Icon="@Icons.Material.Filled.Stop" Color="Color.Error" OnClick="@(async () => await this.MediaTranscriptionService.StopAsync(this.Owner))"/>
                </MudTooltip>
            </MudStack>
        </MudPaper>
    }
}