import { SdmContext } from "../context/SdmContext";
import { Goals } from "../goal/Goals";
import { PushListenerInvocation } from "../listener/PushListener";
import { GoalSettingStructure } from "../mapping/GoalSetter";
import { Mapping } from "../mapping/Mapping";
import { Predicated } from "../mapping/PredicateMapping";
import { GoalComponent } from "./GoalComponent";
export interface GoalContribution<F> extends Mapping<F, GoalComponent>, Predicated<F> {
}
/**
 * Add state to an invocation. Only available in memory.
 * @param S type of the fact to add.
 */
export interface StatefulInvocation<S> extends SdmContext {
    facts?: S;
}
export declare type DefaultFacts = Record<string, any>;
/**
 * Within evaluation of push rules we can manage state on a push.
 * This interface allows state. This state will not be persisted.
 */
export interface StatefulPushListenerInvocation<S = DefaultFacts> extends PushListenerInvocation, StatefulInvocation<S> {
}
/**
 * Enrich the invocation, attaching some facts.
 * The returned object will be merged with any facts already on the invocation.
 * @param {(f: (StatefulInvocation<FACT>)) => Promise<FACT>} compute additional facts.
 * @return {GoalContribution<F>}
 */
export declare function attachFacts<FACT, F extends SdmContext = PushListenerInvocation>(compute: (f: F) => Promise<FACT>): GoalContribution<F>;
/**
 * Contribute goals based on a series of contribution rules.
 *
 * Instead of stopping at the first match, each push will get _all_ the goals it qualifies for.
 *
 * Duplicates will be removed.
 *
 * @param contributor first contributor
 * @param {GoalContribution<F>} contributors
 * @return a mapping to goals
 */
export declare function goalContributors<F extends SdmContext = StatefulPushListenerInvocation<any>>(contributor: GoalContribution<F>, ...contributors: Array<GoalContribution<F>>): Mapping<F, Goals>;
/**
 * Enrich the given push mapping with our own contributions
 * @param {Mapping<F extends SdmContext, Goals>} mapping
 * @param {GoalContribution<F extends SdmContext>} contributor
 * @param {GoalContribution<F extends SdmContext>} contributors
 * @return {Mapping<F extends SdmContext, Goals>}
 */
export declare function enrichGoalSetters<F extends SdmContext = StatefulPushListenerInvocation<any>>(mapping: GoalContribution<F>, contributor: GoalContribution<F>, ...contributors: Array<GoalContribution<F>>): Mapping<F, Goals> & GoalSettingStructure<F, Goals>;
//# sourceMappingURL=goalContribution.d.ts.map