import type { PageParams } from '@/lib/api/types';

/**
 * React Query key factory for the patients domain. Hierarchical keys let a mutation
 * invalidate every list (`patientKeys.lists()`) without touching unrelated caches.
 */
export const patientKeys = {
  all: ['patients'] as const,
  lists: () => [...patientKeys.all, 'list'] as const,
  list: (params?: PageParams) => [...patientKeys.lists(), params ?? {}] as const,
  details: () => [...patientKeys.all, 'detail'] as const,
  detail: (id: number) => [...patientKeys.details(), id] as const,
};
