import React from 'react'; /** * Generic Module Factory - Minimal Version * * Provides reusable reducer and context structure for CRUD modules. * API integration is handled by individual modules for maximum flexibility. */ interface ModuleConfig { name: string; displayName: string; initialState: T; drawerTypes: Record; hooks?: { onFormValidation?: (data: any) => Promise; onBeforeSubmit?: (data: any) => Promise; onAfterSubmit?: (state: any, response: any) => Promise; customActions?: Record any>; }; } interface GenericModuleContext { state: T; dispatch: React.Dispatch; } declare const GENERIC_ACTION_TYPES: { readonly RESET_FORM: "RESET_FORM"; readonly SET_CURRENT_PAGE: "SET_CURRENT_PAGE"; readonly SET_PAGE_LIMIT: "SET_PAGE_LIMIT"; readonly SET_SEARCH_QUERY: "SET_SEARCH_QUERY"; readonly SET_DRAWER: "SET_DRAWER"; readonly SET_ITEMS: "SET_ITEMS"; readonly SET_FORM_DATA: "SET_FORM_DATA"; readonly SET_DISABLE_SAVE_BUTTON: "SET_DISABLE_SAVE_BUTTON"; readonly SET_INPUT_FIELD: "SET_INPUT_FIELD"; readonly SET_ERRORS: "SET_ERRORS"; readonly SET_FILTERS: "SET_FILTERS"; }; declare const createGenericReducer: (config: ModuleConfig) => (state: T, action: any) => T; declare const createGenericModuleHook: (config: ModuleConfig) => () => GenericModuleContextWithHandlers; declare const createGenericModuleProvider: (config: ModuleConfig) => { Provider: React.FC<{ children: React.ReactNode; }>; useContext: () => GenericModuleContextWithHandlers; Context: React.Context | undefined>; }; interface GenericModuleContextWithHandlers extends GenericModuleContext { handleSearch?: (query: string) => void; handlePageChange?: (page: number) => void; handlePageLimitChange?: (limit: number) => void; handleCloseDrawer?: () => void; handleSubmit?: (data: any) => void; } declare const createGenericHandlers: (dispatch: React.Dispatch) => Omit, "state" | "dispatch">; declare const createGenericModule: (config: ModuleConfig) => { reducer: (state: T, action: any) => T; Provider: React.FC<{ children: React.ReactNode; }>; useContext: () => GenericModuleContextWithHandlers; config: ModuleConfig; actionTypes: { readonly RESET_FORM: "RESET_FORM"; readonly SET_CURRENT_PAGE: "SET_CURRENT_PAGE"; readonly SET_PAGE_LIMIT: "SET_PAGE_LIMIT"; readonly SET_SEARCH_QUERY: "SET_SEARCH_QUERY"; readonly SET_DRAWER: "SET_DRAWER"; readonly SET_ITEMS: "SET_ITEMS"; readonly SET_FORM_DATA: "SET_FORM_DATA"; readonly SET_DISABLE_SAVE_BUTTON: "SET_DISABLE_SAVE_BUTTON"; readonly SET_INPUT_FIELD: "SET_INPUT_FIELD"; readonly SET_ERRORS: "SET_ERRORS"; readonly SET_FILTERS: "SET_FILTERS"; }; initialState: T; createHandlers: (dispatch: React.Dispatch) => Omit, "state" | "dispatch">; }; export { GENERIC_ACTION_TYPES, type GenericModuleContext, type GenericModuleContextWithHandlers, type ModuleConfig, createGenericHandlers, createGenericModule, createGenericModuleHook, createGenericModuleProvider, createGenericReducer };