import { useQuery, type UseQueryResult } from '@tanstack/react-query';
import { fetchPhotos } from '@/api/photos';
import type { Photo } from '@/types';
import { STALE_TIME } from './refreshConfig';

export function usePhotos(deviceId?: string): UseQueryResult<Photo[]> {
  return useQuery({
    queryKey: ['photos', deviceId],
    queryFn: () => fetchPhotos(100, undefined, deviceId),
    staleTime: STALE_TIME,
  });
}
