import { queryOptions } from '@tanstack/react-query'
import { getAppSettings, getConfig, getInstanceV1 } from 'src/lib/api'
import { queryKeys } from './keys'

export const settingsQueries = {
  config: () =>
    queryOptions({
      queryKey: queryKeys.settings.config(),
      queryFn: getConfig,
      staleTime: 60 * 60 * 1000,
      gcTime: Number.POSITIVE_INFINITY,
    }),

  instanceV1: () =>
    queryOptions({
      queryKey: queryKeys.settings.instanceV1(),
      queryFn: getInstanceV1,
      staleTime: 60 * 60 * 1000,
      gcTime: Number.POSITIVE_INFINITY,
    }),

  appSettings: () =>
    queryOptions({
      queryKey: queryKeys.settings.appSettings(),
      queryFn: getAppSettings,
      staleTime: 60 * 60 * 1000,
      gcTime: Number.POSITIVE_INFINITY,
    }),
}
