import type { RouteLocationRaw } from 'vue-router'
import type { NotificationItem } from '../types/notification.types'

export function resolveNotificationRoute(notification: NotificationItem): RouteLocationRaw | null {
  const userId = notification.data.user_id

  if (notification.type === 'user_activation_required') {
    if (userId) {
      return { name: 'edit-user', params: { id: String(userId) } }
    }

    return { name: 'list-users' }
  }

  const route = notification.navigation.route

  if (route === '/users') {
    if (userId) {
      return { name: 'edit-user', params: { id: String(userId) } }
    }

    return { name: 'list-users' }
  }

  if (route === '/dashboard') {
    return { name: 'dashboard-overview-1' }
  }

  return null
}
