import type { Dispatch, SetStateAction } from 'react';
import type { CategoryConfig } from '../CheckBoxGroup/index';
import type { BaseApiClient } from '../types/api';
import type { Class } from './categoryDataUtils';
import type { FetchStudentsByFiltersFunction } from './studentTypes';
/**
 * Function type for fetching classes by filters
 */
export type FetchClassesByFiltersFunction = (apiClient: BaseApiClient, filters: {
    schoolIds?: string[];
    schoolYearIds?: string[];
}) => Promise<Class[]>;
export interface UseDynamicStudentFetchingOptions {
    apiClient?: BaseApiClient;
    fetchStudentsByFilters?: FetchStudentsByFiltersFunction;
    fetchClassesByFilters?: FetchClassesByFiltersFunction;
    onError?: (error: Error) => void;
}
/**
 * Hook to dynamically load BOTH turmas and alunos based on category selections.
 *
 * This hook provides a `handleCategoriesChange` function that:
 * - Detects changes in school/series/class selections
 * - Fetches turmas (classes) when the school/série selection changes and a série
 *   is selected; clears turmas when the série selection becomes empty
 * - Fetches alunos (students) only when school/series/class selections change and
 *   a turma is selected (not when only students are toggled); clears alunos otherwise
 * - Writes each fetched set back into ONLY its own category via functional state
 *   updates, so a late turma response never clobbers a student write and vice-versa
 * - Transforms fetched turmas/alunos into the correct format for CategoryConfig
 *   (turma items carry `schoolYearId` so the turma `filteredBy` does not hide them)
 * - Uses separate request-id guards for turmas and alunos to drop stale responses
 * - Handles errors gracefully
 *
 * @param setCategories - React state setter for categories (supports functional updates)
 * @param options - Configuration options
 * @returns Object with handleCategoriesChange function
 */
export declare function useDynamicStudentFetching(setCategories: Dispatch<SetStateAction<CategoryConfig[]>>, options?: UseDynamicStudentFetchingOptions): {
    handleCategoriesChange: (updatedCategories: CategoryConfig[]) => Promise<void>;
};
//# sourceMappingURL=useDynamicStudentFetching.d.ts.map