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

// Mastodon-only list catalogue — Phase B §3.3 of the Mastodon follow-up plan.
// `getMastodonLists` is `mastodonActiveContext()`-asserted, so consumers must
// gate on `user.type === 'mastodon'` before subscribing.
export const listsQueries = {
  lists: () =>
    queryOptions({
      queryKey: queryKeys.lists.lists(),
      queryFn: getMastodonLists,
      staleTime: 5 * 60 * 1000,
      gcTime: 60 * 60 * 1000,
    }),
}
