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

function useMyToast() {
  const toast = useToast();

  /**
   * Show a toast with custom options
   * @param {object} options The options for the toast
   * @param {string} options.title The title of the toast
   * @param {string} [options.description] The description of the toast
   * @param {"info"|"warning"|"success"|"error"} [options.status] The status of the toast
   * @param {boolean} [options.isClosable] Whether the toast is closable
   * @param {number} [options.duration] Duration in milliseconds (ms)
   * @param {"top-right"|"top-left"|"bottom-right"|"bottom-left"|"top"|"bottom"} [options.position] Position of the toast
   */
  return (options) =>
    toast({
      position: 'top-right',
      duration: 9000,
      isClosable: true,
      ...options, // This allows you to override the default options
    });
}

export default useMyToast;
