import type { EmptyObject } from '../../../../framework-types/BaseTypes';
import type { ContextHaving } from '../../../../framework-types/execution-context/Types';
import type { NamedTask, Task } from '../../../../framework-types/task/Types';
import type { ContextWithState } from '../../Types';
import { CoreExportNames } from '../Types';
import type { CoreUtils } from '../utils/Types';
import type { StateAtom } from './Types';
export interface StateMachine<S> {
    current: S;
    previous: S;
}
export type StateMachineAtom<S extends string, _ extends ContextWithState, D = void> = StateAtom<StateMachine<S>, {
    updateState: (state: StateMachine<S>, data: D) => boolean;
}>;
export type Transition<S extends string, C extends ContextWithState, D = void> = (context: C, data: D) => S;
export type TransitionMap<S extends string, C extends ContextWithState, D = void> = {
    [key in S]: Transition<S, C, D>;
};
export type Handler<S extends string, C extends ContextWithState, D = void> = NamedTask<Task<C, StateMachineAtom<S, C, D>, void>>;
export type HandlerMap<S extends string, C extends ContextWithState, D = void> = {
    [key in S]?: Handler<S, C, D>;
};
export declare function createStateMachineAtom<S extends string, C extends ContextWithState, D = void>(context: C, initialState: S, transitions: TransitionMap<S, C, D>, handlers?: HandlerMap<S, C, D>): StateMachineAtom<S, C, D>;
export declare function flushPendingUpdates(context: ContextWithState, stateMachine: StateMachineAtom<string, ContextWithState>): void;
type ContextWithStateAndLogger = ContextHaving<{
    [CoreExportNames.Utils]: CoreUtils;
}, EmptyObject, ContextWithState>;
export declare function logTransitions<S extends string, C extends ContextWithState, D = void>(context: ContextWithStateAndLogger, stateMachine: StateMachineAtom<S, C, D>, name: string): void;
export {};
