/** * Hook de chargement des sujets disponibles pour une tâche. * * Règle H : aucune logique métier ici — mapping Tache → filtres DB dans * `entities/production/api.ts` (getSujets). Le hook ne fait qu'encapsuler * la requête TanStack Query avec un staleTime généreux (le catalogue de * sujets change rarement). */ import { useQuery } from '@tanstack/react-query' import { getSujets } from '@/entities/production/api' import type { SujetData, Tache } from '@/entities/production/types' export function useSujets(tache: Tache, enabled: boolean = true) { return useQuery({ queryKey: ['sujets', tache], queryFn: () => getSujets(tache), staleTime: 10 * 60 * 1000, enabled, }) }