import { useQuery } from '@tanstack/react-query'
import { listMedios } from '../api/listMedios'
import type { MediosQuery } from '../types'

export const mediosListQueryKey = (query: MediosQuery) => ['medios', 'list', query] as const

export function useMediosList(query: MediosQuery) {
  return useQuery({
    queryKey: mediosListQueryKey(query),
    queryFn: () => listMedios(query),
    staleTime: 15_000,
  })
}
