import { useQuery } from '@tanstack/react-query';
import { partnerCenterApi } from '../apis';
import { centerKeys } from '../keys';
import { PARTNER_DETAIL_STALE_TIME, PARTNER_GC_TIME } from '../constants';

/** The sponsored-nurse roster for one center (admin detail). */
export function useCenterSponsoredNurses(id: number | null) {
  return useQuery({
    queryKey: centerKeys.sponsoredNurses(id ?? -1),
    queryFn: () => partnerCenterApi.getCenterSponsoredNurses(id!),
    enabled: id != null && id > 0,
    staleTime: PARTNER_DETAIL_STALE_TIME,
    gcTime: PARTNER_GC_TIME,
  });
}
