export type FSMState = string;
export type FSMEventBase = {
    type: string;
};
export type FSMTransitionConfig<S extends FSMState, E extends FSMEventBase> = {
    [K in S]: {
        [T in E["type"]]?: S;
    };
};
export type FSMOnTransition<S extends FSMState, E extends FSMEventBase> = (params: {
    from: S;
    to: S;
    event: E;
}) => void | Promise<void>;
export type FSMOnTransitionParams<S extends FSMState, E extends FSMEventBase> = Parameters<FSMOnTransition<S, E>>[0];
export type FSMMetadata<S extends FSMState> = {
    [K in S]?: Record<string, unknown>;
};
export type FSMTransitionHandlerFactory<S extends FSMState, E extends FSMEventBase> = (fsm: FSM<S, E, any>) => FSMOnTransition<S, E>;
export type FSMConfig<S extends FSMState, E extends FSMEventBase, C> = {
    transitions: FSMTransitionConfig<S, E>;
    initialState: S;
    initialContext: C;
    createTransitionHandler: FSMTransitionHandlerFactory<S, E>;
    metadata?: FSMMetadata<S>;
};
export declare class FSM<S extends FSMState, E extends FSMEventBase, C> {
    private _state;
    get state(): S;
    private _context;
    get context(): C;
    private transitions;
    protected onTransition: FSMOnTransition<S, E>;
    private metadata;
    private initialMetadata;
    constructor(config: FSMConfig<S, E, C>);
    updateContext(update: Partial<C> | ((prev: C) => C)): void;
    getMetadata<T extends Record<string, unknown> = Record<string, unknown>>(): T | undefined;
    updateMetadata<T extends Record<string, unknown> = Record<string, unknown>>(update: Partial<T> | ((prev: T) => T)): void;
    resetAllMetadata(): void;
    send(event: E): Promise<void>;
}
//# sourceMappingURL=fsm.d.ts.map