import { useCallback } from 'react';
import { toast, Slide, Bounce, Flip, Zoom } from 'react-toastify';
import { classes } from './ToastStyles';
import cx from 'classnames';
import { cond, equals, always, T } from 'ramda';
const useToast = () => {
    return useCallback(
    /**
     *
     * @param {ToastContent} message The content to be displayed
     * @param {('success'|'info'|'warning'|'error')} variant The type of the toast
     * @param {ToastOptions} options Additional options passed to the toast
     */
    (message, variant, { transitionType, autoClose, ...restOptions } = {}) => {
        const toastClasses = cx({
            [classes[variant]]: variant,
            [classes['default']]: true
        });
        const getTransitionType = cond([
            [equals('Slide'), always(Slide)],
            [equals('Bounce'), always(Bounce)],
            [equals('Flip'), always(Flip)],
            [equals('Zoom'), always(Zoom)],
            [T, always(Slide)]
        ]);
        const options = {
            ...restOptions,
            autoClose: autoClose || false,
            transition: getTransitionType(transitionType),
            className: toastClasses
        };
        switch (variant) {
            case 'error':
                toast.error(message, options);
                break;
            case 'info':
                toast.info(message, options);
                break;
            case 'success':
                toast.success(message, options);
                break;
            case 'warning':
                toast.warn(message, options);
                break;
            default:
                toast(message, options);
                break;
        }
    }, []);
};
export default useToast;
//# sourceMappingURL=useToast.js.map