"use client";
import { toast } from "sonner";
function useToast() {
  return {
    toast: ({
      title,
      description,
      action,
      ...props
    } = {}) => {
      const { variant = "default", ...rest } = props;
      switch (variant) {
        case "destructive":
          return toast.error(title || "Error", {
            description,
            action: action ? {
              label: action.label,
              onClick: action.onClick
            } : void 0,
            ...rest
          });
        case "success":
          return toast.success(title || "Success", {
            description,
            action: action ? {
              label: action.label,
              onClick: action.onClick
            } : void 0,
            ...rest
          });
        case "warning":
          return toast.warning(title || "Warning", {
            description,
            action: action ? {
              label: action.label,
              onClick: action.onClick
            } : void 0,
            ...rest
          });
        default:
          return toast(title || "Notification", {
            description,
            action: action ? {
              label: action.label,
              onClick: action.onClick
            } : void 0,
            ...rest
          });
      }
    },
    success: (title, description) => toast.success(title, { description }),
    error: (title, description) => toast.error(title, { description }),
    warning: (title, description) => toast.warning(title, { description }),
    info: (title, description) => toast.info(title, { description }),
    dismiss: toast.dismiss
  };
}
export {
  useToast
};
