import { createContext, useContext } from "react"; export interface Notification { message: string; type: "error" | "success" | "info"; duration?: number; // in milliseconds } export interface NotificationContextType { notifications: Notification[]; addNotification: (notification: Notification) => void; removeNotification: (id: string) => void; removeAllNotifications: () => void; } export const NotificationContext = createContext< NotificationContextType | undefined >(undefined); export const useNotifications = () => { const context = useContext(NotificationContext); if (!context) { throw new Error( "useNotifications must be used within a NotificationProvider" ); } return context; };