import { useQuery } from '@tanstack/react-query';
import { memberApi } from '@/api';

/**
 * 멤버 목록 조회 훅
 */
export function useMembers() {
  return useQuery({
    queryKey: ['members'],
    queryFn: memberApi.getMembers,
    staleTime: 1000 * 60 * 10, // 10분 캐시
  });
}

/**
 * 멤버 상세 조회 훅
 * @param {string} name - 멤버 이름
 */
export function useMemberDetail(name) {
  return useQuery({
    queryKey: ['member', name],
    queryFn: () => memberApi.getMemberByName(name),
    enabled: !!name,
  });
}
