// Store all notifications in one place
import { ref } from 'vue';
import { MessageType } from '../types';

const messages = ref<MessageType[]>([]);

export function useNotificationStore() {
    const addNotification = (message : MessageType, hideAfterSeconds = 10) => {
        messages.value.push(message);

        // Automatically remove after 10s
        setTimeout(() => {
            messages.value.shift();
        }, hideAfterSeconds * 1000);
    };

    return {
        messages,
        addNotification,
    };
}
