@inherits MSGComponentBase
@typeparam TSettings

@if (this.IsVisible)
{
    <MudCard Outlined="@true" Style="@this.BlockStyle">
        <MudCardHeader>
            <CardHeaderContent>
                <MudStack AlignItems="AlignItems.Center" Row="@true">
                    <MudElement HtmlTag="span" Style="position: relative; display: inline-flex; line-height: 1;">
                        <MudIcon Icon="@this.Icon" Size="Size.Large" Color="Color.Primary"/>
                        @if (this.AssistantSessionIndicator is { } indicator)
                        {
                            <MudTooltip Text="@indicator.Tooltip">
                                <MudElement HtmlTag="span" Style="position: absolute; right: -0.45rem; bottom: -0.3rem; display: inline-flex; background-color: var(--mud-palette-surface); border-radius: 50%; padding: 1px;">
                                    <MudIcon Icon="@indicator.Icon" Size="Size.Small" Color="@indicator.Color"/>
                                </MudElement>
                            </MudTooltip>
                        }
                    </MudElement>
                    <MudText Typo="Typo.h6">
                        @this.Name
                    </MudText>
                </MudStack>
            </CardHeaderContent>
        </MudCardHeader>
        <MudCardContent>
            <MudStack>
                <MudText>
                    @this.Description
                </MudText>
            </MudStack>
        </MudCardContent>
        <MudCardActions>
            <MudStack Row="@true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween" Style="width: 100%;">
                <MudButtonGroup Variant="Variant.Outlined">
                    @if (this.HasStartAction)
                    {
                        <MudButton Size="Size.Large" Variant="Variant.Filled" StartIcon="@this.Icon" Color="Color.Default" OnClick="@this.OnClick" Disabled="@this.Disabled">
                            @this.ButtonText
                        </MudButton>
                    }
                    else
                    {
                        <MudButton Size="Size.Large" Variant="Variant.Filled" StartIcon="@this.Icon" Color="Color.Default" Href="@this.Link" Disabled="@this.Disabled">
                            @this.ButtonText
                        </MudButton>
                    }
                    @if (this.HasSettingsPanel)
                    {
                        <MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" Color="Color.Default" OnClick="@this.OpenSettingsDialog"/>
                    }
                </MudButtonGroup>
                @if (this.SecurityBadge is not null || this.AdditionalActions is not null)
                {
                    <MudStack Row="@true" AlignItems="AlignItems.Center" Spacing="1">
                        @if (this.SecurityBadge is not null)
                        {
                            <MudElement>
                                @this.SecurityBadge
                            </MudElement>
                        }
                        @this.AdditionalActions
                    </MudStack>
                }
            </MudStack>
        </MudCardActions>
    </MudCard>
}
