import { IS_OPERATOR } from "./utils.js";
import { ContextFunction, EventType, ResolveAction } from "./internalTypes.js";
import { IFlushCallback, IMutationCallback } from "proxy-state-tree";

//#region src/types.d.ts

type IConfiguration = {
  state?: {};
  effects?: {};
  actions?: {};
};
type IState = {
  [key: string]: IState | string | number | boolean | object | null | undefined;
};
type IContext<T extends IConfiguration> = {
  state: T['state'];
  actions: { [K in keyof T['actions']]: ResolveAction<T['actions'][K]> };
  effects: T['effects'];
  reaction: IReaction<{
    state: T['state'];
  }>;
  addMutationListener: (cb: IMutationCallback) => () => void;
  addFlushListener: (cb: IFlushCallback) => () => void;
};
interface IAction<I, O> extends ContextFunction<I, O> {}
interface IOperator<I, O> extends ContextFunction<I, O> {
  [IS_OPERATOR]: true;
}
interface IReaction<T extends {
  state?: IState;
}> {
  <O>(stateCallback: (state: T['state']) => O, updateCallback: (value: O) => void, options?: {
    nested?: boolean;
    immediate?: boolean;
  }): () => void;
}
//#endregion
export { IAction, IConfiguration, IContext, IOperator, IReaction, IState };
//# sourceMappingURL=types.d.ts.map