import { debounce } from "lodash";
import { UIStore } from "ui/domain/uiStore";

type ClearNotificationsUIStore = Pick<UIStore, "clearNotifications">

const deboucedTask = debounce((task) => Promise.resolve(task()), 300);

const clearNotificationsUseCase = (store: ClearNotificationsUIStore) => {
  return deboucedTask(() => store.clearNotifications());
}

export {clearNotificationsUseCase};