import { queryOptions } from '@tanstack/react-query'
import { getNewsroomTimeline } from 'src/lib/api'
import { queryKeys } from './keys'

export const newsroomQueries = {
  // Server returns only unread items, already filtered by the per-profile
  // `newsroom:read:*` Redis set. Same foreground cadence as the bell-tab
  // unread count so the settings-row badge stays current.
  timeline: () =>
    queryOptions({
      queryKey: queryKeys.newsroom.timeline(),
      queryFn: getNewsroomTimeline,
      refetchInterval: 60 * 1000,
      refetchOnWindowFocus: true,
      staleTime: 30 * 1000,
      gcTime: 30 * 60 * 1000,
      retry: false,
    }),
}
