import { type ReactNode, type Dispatch, type SetStateAction } from "react";
import type { PaginationInterface } from "../interfaces";
export interface CrudContextType<T> {
    list: Array<T> | undefined;
    item: T | undefined;
    page: number;
    pages: number;
    total: number;
    limit: number;
    isLoading: boolean;
    pagination: ReactNode;
    params: Record<string, any>;
    extraData?: Record<string, any>;
    setExtraData: Dispatch<SetStateAction<Record<string, any> | undefined>>;
    fetchItems: {
        execute: (params?: Record<string, any>) => Promise<void>;
        isLoading: boolean;
    };
    fetchItem: {
        execute: (params?: Record<string, any> | string | number) => Promise<T | undefined>;
        isLoading: boolean;
    };
    createItem: {
        execute: (item: T) => Promise<T | undefined | null>;
        isLoading: boolean;
    };
    updateItem: {
        execute: (item: T) => Promise<T | undefined | null>;
        isLoading: boolean;
    };
    deleteItem: {
        execute: (item: T) => Promise<void>;
        isLoading: boolean;
    };
}
export declare const CrudContext: import("react").Context<CrudContextType<any> | undefined>;
export interface PromiseWithOptions<TResult, TParams extends any[] = []> {
    execute: (...params: TParams) => Promise<TResult>;
    successMessage?: string;
    errorMessage?: string;
}
interface CrudProviderProps<T> {
    children: ReactNode;
    getPromise?: ((params?: Record<string, any>) => Promise<Array<T> | PaginationInterface<T> | undefined>) | PromiseWithOptions<Array<T> | PaginationInterface<T> | undefined, [
        params?: Record<string, any>
    ]>;
    getItemPromise?: ((params?: Record<string, any> | string | number) => Promise<T | undefined>) | PromiseWithOptions<T | undefined, [
        params?: Record<string, any> | string | number
    ]>;
    postPromise?: ((item: T) => Promise<T | undefined | null>) | PromiseWithOptions<T | undefined | null, [item: T]>;
    putPromise?: ((item: T) => Promise<T | undefined | null>) | PromiseWithOptions<T | undefined | null, [item: T]>;
    deletePromise?: ((item: T) => Promise<void>) | PromiseWithOptions<void, [item: T]>;
    urlParams?: Array<string>;
    limit?: number;
    pageParam?: string;
    singleItemId?: string | number;
    extraData?: Record<string, any>;
}
export declare function CrudProvider<T>({ children, getPromise, getItemPromise, postPromise, putPromise, deletePromise, limit, pageParam, urlParams, singleItemId, extraData: extraDataProp, }: CrudProviderProps<T>): import("react/jsx-runtime").JSX.Element;
export declare function useCrud<T>(): CrudContextType<T>;
export {};
//# sourceMappingURL=CrudContext.d.ts.map