import { Configuration, ConfigurationPostProcessor } from "@atomist/automation-client/lib/configuration";
import { SdmContext } from "../../api/context/SdmContext";
import { GoalContribution } from "../../api/dsl/goalContribution";
import { Goal } from "../../api/goal/Goal";
import { Goals } from "../../api/goal/Goals";
import { GoalWithFulfillment } from "../../api/goal/GoalWithFulfillment";
import { PushListenerInvocation } from "../../api/listener/PushListener";
import { SoftwareDeliveryMachine } from "../../api/machine/SoftwareDeliveryMachine";
import { PushTest } from "../../api/mapping/PushTest";
import { ConfigureOptions } from "./configureSdm";
import { LocalSoftwareDeliveryMachineConfiguration } from "./LocalSoftwareDeliveryMachineOptions";
/**
 * Data structure to configure goal contributions
 */
export interface GoalStructure {
    /**
     * Optional push tests to determine when to schedule provided goals
     *
     * If an array of push tests is provided, they will get wrapped with allSatisfied/and.
     */
    test?: PushTest | PushTest[];
    /** Optional pre conditions for goals; can be actual goal instances or names of goal contributions */
    dependsOn?: string | Goal | Array<string | Goal>;
    /**
     * Goal instances to schedule
     *
     * The following cases are supported:
     *
     * goals: [
     *  autofix,
     *  build
     * ]
     *
     * This means autofix will run after build
     *
     * goals: [
     *  [autofix, build]
     * ]
     *
     * This will schedule autofix and build concurrently
     *
     * goals: [
     *  [autofix, build],
     *  dockerBuild
     * ]
     *
     * This will schedule autofix and build concurrently and dockerBuild once autofix and build are completed
     */
    goals: Goal | Goals | Array<Goal | Goals | Array<Goal | Goals>>;
}
/**
 * Type to collect named GoalStructure instances
 *
 * The record key will be used to name the goal contribution.
 */
export declare type GoalData = Record<string, GoalStructure>;
/**
 * Type to collect goal instances for this SDM
 */
export declare type DeliveryGoals = Record<string, Goal | GoalWithFulfillment>;
/**
 * Type to create goal instances for this SDM
 */
export declare type GoalCreator<G extends DeliveryGoals> = (sdm: SoftwareDeliveryMachine) => Promise<G>;
/**
 * Type to configure provided goals with fulfillments, listeners etc
 */
export declare type GoalConfigurer<G extends DeliveryGoals> = (sdm: SoftwareDeliveryMachine, goals: G) => Promise<void>;
/**
 * Type to orchestrate the creation and configuration of goal instances for this SDM
 */
export declare type CreateGoals<G extends DeliveryGoals> = (creator: GoalCreator<G>, configurers?: GoalConfigurer<G> | Array<GoalConfigurer<G>>) => Promise<G>;
/**
 * Configure a SoftwareDeliveryMachine instance by adding command, events etc and optionally returning
 * GoalData, an array of GoalContributions or void when no goals should be added to this SDM.
 */
export declare type Configurer<G extends DeliveryGoals, F extends SdmContext = PushListenerInvocation> = (sdm: SoftwareDeliveryMachine & {
    createGoals: CreateGoals<G>;
}) => Promise<void | GoalData | Array<GoalContribution<F>>>;
/**
 *  Process the configuration before creating the SDM instance
 */
export declare type ConfigurationPreProcessor = (cfg: LocalSoftwareDeliveryMachineConfiguration) => Promise<LocalSoftwareDeliveryMachineConfiguration>;
export interface ConfigureMachineOptions extends ConfigureOptions {
    /**
     * SDM name if you want to override the default which uses the
     * package name.
     */
    name?: string;
    /**
     * These functions are called in the first postProcessor.
     * Specifically, the first post-processor is [[configureSdm]]
     * these functions are called in its
     * [[SoftwareDeliveryMachineMaker]] function prior to it calling
     * the [[createSoftwareDeliveryMachine]].
     */
    preProcessors?: ConfigurationPreProcessor | ConfigurationPreProcessor[];
    /**
     * These functions are called after the [[configureSdm]] post-processor.
     */
    postProcessors?: ConfigurationPostProcessor | ConfigurationPostProcessor[];
}
/**
 * Function to create an SDM configuration constant to be exported from an index.ts/js.
 */
export declare function configure<G extends DeliveryGoals, T extends SdmContext = PushListenerInvocation>(configurer: Configurer<G, T>, options?: ConfigureMachineOptions): Configuration;
/**
 * Convert the provided GoalData instance into an array of GoalContributions
 */
export declare function convertGoalData(goalData: GoalData): Array<GoalContribution<any>>;
/**
 * Invoke the given configurer
 */
export declare function invokeConfigurer(sdm: SoftwareDeliveryMachine, configurer: Configurer<any, any>): Promise<void | GoalData | Array<GoalContribution<any>>>;
//# sourceMappingURL=configure.d.ts.map