import type { PageParams } from '@/lib/api/types';

/**
 * React Query key factory for the notifications domain. The **page keys the list** (unread-first, paginated);
 * `unreadCount` is its own tiny key so the polling bell reads the count **without** touching the list cache
 * (the count re-fetches on an interval; the list does not). Mark-read mutations `setQueryData` both keys
 * optimistically, then invalidate on settle.
 */
export const notificationKeys = {
  all: ['notifications'] as const,

  lists: () => [...notificationKeys.all, 'list'] as const,
  list: (params: PageParams) => [...notificationKeys.lists(), params] as const,

  unreadCount: () => [...notificationKeys.all, 'unread_count'] as const,
};
