@namespace Lumeo

<div class="@CssClass" role="alert" @attributes="AdditionalAttributes">
    @ChildContent
</div>

@code {
    [Parameter] public RenderFragment? ChildContent { get; set; }
    [Parameter] public ToastVariant Variant { get; set; } = ToastVariant.Default;
    [Parameter] public string? Class { get; set; }
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object>? AdditionalAttributes { get; set; }

    private string CssClass => $"group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border border-border/50 p-4 pr-11 sm:pr-6 shadow-lg animate-toast-in {VariantClasses} {Class}".Trim();

    private string VariantClasses => Variant switch
    {
        ToastVariant.Default => "bg-card text-foreground",
        ToastVariant.Success => "border-success/50 bg-success-light text-success-text",
        ToastVariant.Destructive => "border-destructive/50 bg-destructive-light text-destructive-text",
        ToastVariant.Warning => "border-warning/50 bg-warning-light text-warning-text",
        ToastVariant.Info => "border-info/50 bg-info-light text-info-text",
        _ => "bg-card text-foreground"
    };
}
