import { ReactNode } from 'react';
import { UseMutationOptions, UseMutationResult } from 'react-query';
import { ToastContextState } from './ToastProvider';
export type MutationConfig<T> = {
    mutation: T;
    name: string;
};
declare type GetResults<T> = T extends MutationConfig<MinimalMutationResult<infer TData, infer TError>> ? MutationConfig<MinimalMutationResult<TData, TError>> : T extends MinimalMutationResult<infer TData, infer TError> ? MutationConfig<MinimalMutationResult<TData, TError>> : MutationConfig<MinimalMutationResult<unknown, unknown>>;
declare type GetDescriptionBuilder<T> = T extends MutationConfig<MinimalMutationResult<infer TData, infer TError>> ? DescriptionBuilder<TData, TError> : T extends MutationConfig<UseMutationOptions<infer TData, infer TError>> ? DescriptionBuilder<TData, TError> : T extends MinimalMutationResult<infer TData, infer TError> ? DescriptionBuilder<TData, TError> : never;
/**
 * MutationResults reducer recursively maps type param to results
 */
declare type MutationsResults<T extends unknown[]> = T extends [] ? [] : T extends [infer Head, ...infer Tail] ? [GetResults<Head>, ...MutationsResults<Tail>] : T extends [infer Head] ? [GetResults<Head>] : unknown[] extends T ? T : never;
declare enum DescriptionBuilderStatus {
    Success = "success",
    Error = "error"
}
type DescriptionBuilder<Data = unknown, Error = unknown> = {
    error?: Error;
    data?: Data;
    status: DescriptionBuilderStatus;
    name: string;
};
declare type DescriptionBuilders<T extends any[]> = T extends [] ? [] : T extends [infer Head, ...infer Tail] ? [GetDescriptionBuilder<Head>, ...DescriptionBuilders<Tail>] : T extends [infer Head] ? [GetDescriptionBuilder<Head>] : T extends UseMutationOptions<infer TMutationFnData, infer TError, infer TData>[] ? DescriptionBuilder<unknown extends TData ? TMutationFnData : TData, TError>[] : DescriptionBuilder[];
type Props<MainMutationType, T extends any[]> = {
    mainMutation: MutationConfig<MainMutationType>;
    dependantMutations?: readonly [...MutationsResults<T>] | MutationConfig<MinimalMutationResult<unknown, unknown>>[];
    messageDescriptionBuilder: (mutations: T extends [] ? [GetDescriptionBuilder<MainMutationType>] : [GetDescriptionBuilder<MainMutationType>, ...DescriptionBuilders<T>]) => ReactNode;
    toastProps?: Pick<ToastContextState, 'style' | 'autoDismiss' | 'position' | 'duration' | 'withProgressBar'>;
} & ({
    onMainMutationSuccess?: () => void;
    onAllMutationsSuccess?: never;
} | {
    onAllMutationsSuccess?: () => void;
    onMainMutationSuccess?: never;
});
type MinimalMutationResult<TData, TError> = Pick<UseMutationResult<TData, TError, unknown, unknown>, 'isError' | 'isIdle' | 'isSuccess' | 'isLoading' | 'error' | 'data'>;
export declare const useMutationsHandler: <MainMutationType extends MinimalMutationResult<unknown, unknown>, T extends any[] | []>({ mainMutation, dependantMutations, messageDescriptionBuilder, toastProps, ...rest }: Props<MainMutationType, T>) => void;
export {};
//# sourceMappingURL=useMutationsHandler.d.ts.map