import { TCalculationProcess } from 'client/stores/CalculationStore/subStores/calculationProcess';
import { IReactionOptions, IReactionPublic, Lambda } from 'mobx';
import { ICalculationStore } from './';

export type ActionsNames = 'calculate' | 'createKP';

export type TAction = {
  [actionName in ActionsNames]?: () => void;
};

export interface IAutorunEffect {
  (CalculationStore: ICalculationStore): () => void;
}

export interface IReactionEffect {
  (
    CalculationStore: ICalculationStore,
    calculationProcess: TCalculationProcess,
  ): {
    expression: (r: IReactionPublic) => any;
    effect: (arg: any, prev: any, r: IReactionPublic) => void;
    options?: IReactionOptions<any, boolean>;
  };
}

export interface IWhenEffect {
  (CalculationStore: ICalculationStore): {
    predicate: () => boolean;
    effect: Lambda;
  };
}
