import { useToast } from '@chakra-ui/react';
import { useCallback } from 'react';

const useShowToast = () => {
  const toast = useToast();

  const showToast = useCallback(
    (
      title: string,
      status: 'info' | 'warning' | 'success' | 'error',
      description?: string,
    ) => {
      toast({
        title,
        description,
        status,
        duration: 5000,
        isClosable: true,
        position: 'top-right',
      });
    },
    [toast],
  );

  return showToast;
};

export default useShowToast;
