using MudBlazor;

namespace Insight.Web.Constants;

public static class Notification
{
    public static class Default
    {
        public static void Options(SnackbarOptions options)
        {
            options.HideIcon = true;
            options.ShowCloseIcon = false;
            options.RequireInteraction = false;
            options.ShowTransitionDuration = 0;
            options.HideTransitionDuration = 1000;
            options.VisibleStateDuration = 3000;
        }
    }

    public static void Information(ISnackbar snackbar, string message, Action<SnackbarOptions>? options = null, string key = "")
    {
        snackbar.Add(message, Severity.Info, options ?? Default.Options, key);
    }

    public static void Success(ISnackbar snackbar, string? message = null, Action<SnackbarOptions>? options = null, string key = "")
    {
        snackbar.Add(message ?? "Success", Severity.Success, options ?? Default.Options, key);
    }

    public static void Warning(ISnackbar snackbar, string message, Action<SnackbarOptions>? options = null, string key = "")
    {
        snackbar.Add(message, Severity.Warning, options ?? Default.Options, key);
    }

    public static void Error(ISnackbar snackbar, string? message = null, Action<SnackbarOptions>? options = null, string key = "")
    {
        snackbar.Add(message ?? "Error", Severity.Error, options ?? Default.Options, key);
    }
}