import { defineStore, type StoreDefinition } from 'pinia'
import type { Notification } from '@/types'

export const useNotificationStore: StoreDefinition = defineStore('notifications', {
  state: () => ({
    notifications: [] as Notification[]
  }),
  getters: {
    getNotifications: (state: any) => state.notifications
  },
  actions: {
    addNotification(notification: Notification) {
      this.notifications.push(notification)
    },
    removeNotification(id: string) {
      this.notifications = this.notifications.filter((notification: Notification) => notification.id !== id)
    }
  }
})