import { useQuery } from '@tanstack/react-query';
import { useIsAuthenticated } from '@/hooks';
import { profilesApi } from '../apis';
import { profileKeys } from '../keys';
import { PROFILE_STALE_TIME } from '../constants';

/** The signed-in nurse's own seller profile. `null` until bootstrapped (B7). */
export function useNurseProfile() {
  const isAuthenticated = useIsAuthenticated();
  return useQuery({
    queryKey: profileKeys.nurse(),
    queryFn: () => profilesApi.getNurseProfile(),
    enabled: isAuthenticated,
    staleTime: PROFILE_STALE_TIME,
  });
}
