import { type PayloadAction } from "@reduxjs/toolkit";
import { type SagaIterator } from "redux-saga";
import { type DashboardCommandType } from "../commands/base.js";
import { type DashboardCommands } from "../commands/index.js";
import { type DashboardEventType } from "../events/base.js";
import { type DashboardEvents } from "../events/index.js";
import { type IDashboardQuery } from "../queries/base.js";
import { type IDashboardQueryService } from "../store/_infra/queryService.js";
import { type DashboardState } from "../store/types.js";
import { type DashboardContext, type DashboardModelCustomizationFns } from "../types/commonTypes.js";
/**
 * @internal
 */
export interface IMonitoredAction {
    calls: number;
    promise: Promise<PayloadAction<any>>;
    resolve: (action: PayloadAction<any>) => void;
    reject: (e: any) => void;
}
/**
 * @internal
 */
export interface IHeadlessDashboardConfig {
    queryServices?: IDashboardQueryService<any, any>[];
    backgroundWorkers?: ((context: DashboardContext) => SagaIterator<void>)[];
    customizationFns?: DashboardModelCustomizationFns;
}
/**
 * @internal
 */
export declare class HeadlessDashboard {
    private readonly reduxedStore;
    protected monitoredActions: Record<string, IMonitoredAction>;
    protected capturedActions: Array<PayloadAction<any>>;
    protected capturedEvents: Array<DashboardEvents>;
    constructor(ctx: DashboardContext, config?: IHeadlessDashboardConfig);
    protected getOrCreateMonitoredAction: (actionType: string) => IMonitoredAction;
    private onActionCaptured;
    private eventHandler;
    dispatch(action: DashboardCommands | PayloadAction<any>): void;
    /**
     * Convenience function that combines both {@link HeadlessDashboard.dispatch} and {@link HeadlessDashboard.waitFor}.
     *
     * @param action - action (typically a command) to dispatch
     * @param actionType - type of action (typically an event type) to wait for
     * @param timeout - timeout after which the wait fails, default is 1000
     */
    dispatchAndWaitFor(action: DashboardCommands | PayloadAction<any>, actionType: DashboardEventType | DashboardCommandType | string, timeout?: number): Promise<any>;
    private commandFailedRejectsWaitFor;
    private commandRejectedEndsWaitFor;
    /**
     * Starts a dashboard query.
     *
     * @param action - query action
     */
    query<TQueryResult>(action: IDashboardQuery): Promise<TQueryResult>;
    /**
     * Wait for action to occur. The wait is bounded by a timeout that is 1s by default.
     *
     * @param actionType - action type to wait for
     * @param timeout - timeout after which the wait fails, default is 1000
     */
    waitFor(actionType: DashboardEventType | DashboardCommandType | string, timeout?: number): Promise<any>;
    /**
     * select data from the state
     */
    select<TSelectorFactory extends (...args: any[]) => any>(selectorFactory: TSelectorFactory): ReturnType<TSelectorFactory>;
    /**
     * Returns dashboard state.
     */
    protected state(): DashboardState;
}
//# sourceMappingURL=HeadlessDashboard.d.ts.map