@if (!string.IsNullOrEmpty(Message))
{
    <div class="alert alert-@GetStatusClass() alert-dismissible" role="alert">
        <button type="button" class="btn-close" data-bs-dismiss="alert" @onclick="Close"></button>
        @Message
    </div>
}


@code {
    [Parameter]
    public string? Message { get; set; }

    [Parameter]
    public string? StatusClass { get; set; }

    [Parameter]
    public EventCallback OnClose { get; set; }


    public async Task Close(MouseEventArgs ev)
    {
        Message = null;
        await OnClose.InvokeAsync();
    }

    private string GetStatusClass()
    {
        if (Message?.StartsWith("Error") == true)
        {
            return "danger";
        }
        else if (!string.IsNullOrWhiteSpace(StatusClass))
        {
            return StatusClass;
        }
        else
        {
            return "success";
        }
    }

}
