"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFlowWithBranch = exports.getFlowWithMultipleSequences = exports.getFlowWithEndOrError = exports.getFlowWithNoSteps = exports.getFlowWithSteps = void 0;
const FlowConfiguration_1 = require("@appglue/common/dist/Flow/FlowConfiguration");
const FormStep_1 = require("@appglue/common/dist/Flow/Steps/UI/FormStep");
const LogStep_1 = require("@appglue/common/dist/Flow/Steps/General/LogStep");
const MultiOutputTestStep_1 = require("@appglue/common/dist/Flow/Steps/ExampleSteps/MultiOutputTestStep");
const FlowStepSequence_1 = require("@appglue/common/dist/Flow/Structure/FlowStepSequence");
const FlowStepOutputInstructions_1 = require("@appglue/common/dist/Flow/Structure/FlowStepOutputInstructions");
const CandidateSequence_1 = require("@appglue/common/dist/Flow/Structure/CandidateSequence");
const FlowSequenceCompleteStrategy_1 = require("@appglue/common/dist/Flow/Structure/FlowSequenceCompleteStrategy");
function getFlowWithSteps() {
    let flow = new FlowConfiguration_1.FlowConfiguration();
    let step = new FormStep_1.FormStep();
    step.name = "Form";
    flow.sequences[0].addStep(step);
    flow.sequences[0].addStep(new MultiOutputTestStep_1.MultiOutputTestStep());
    flow.sequences[0].addStep(new LogStep_1.LogStep());
    return flow;
}
exports.getFlowWithSteps = getFlowWithSteps;
function getFlowWithNoSteps() {
    let flow = new FlowConfiguration_1.FlowConfiguration();
    return flow;
}
exports.getFlowWithNoSteps = getFlowWithNoSteps;
function getFlowWithEndOrError() {
    let flow = new FlowConfiguration_1.FlowConfiguration();
    flow.endSequence.addStep(new FormStep_1.FormStep());
    flow.endSequence.addStep(new LogStep_1.LogStep());
    flow.errorSequence.addStep(new FormStep_1.FormStep());
    flow.errorSequence.addStep(new LogStep_1.LogStep());
    return flow;
}
exports.getFlowWithEndOrError = getFlowWithEndOrError;
function getFlowWithMultipleSequences() {
    let flow = new FlowConfiguration_1.FlowConfiguration();
    let primaryMultiStep = new MultiOutputTestStep_1.MultiOutputTestStep();
    flow.sequences[0].addStep(new FormStep_1.FormStep());
    flow.sequences[0].addStep(primaryMultiStep);
    flow.sequences[0].addStep(new LogStep_1.LogStep());
    let newSeq = new FlowStepSequence_1.FlowStepSequence();
    newSeq.name = "Test 1";
    newSeq.desiredX = 500;
    newSeq.desiredY = 100;
    let newStep = new MultiOutputTestStep_1.MultiOutputTestStep();
    let secondPathForNewStep = newStep.getOutcomeInstructions()[1];
    secondPathForNewStep.strategy = FlowStepOutputInstructions_1.FlowStepOutputInstructionType.BRANCH;
    let candidate = new CandidateSequence_1.CandidateSequence(secondPathForNewStep);
    secondPathForNewStep.connectedSequenceId = candidate._id;
    newSeq.addStep(newStep);
    newSeq.addStep(new MultiOutputTestStep_1.MultiOutputTestStep());
    flow.addSequence(newSeq);
    let newSeq1 = new FlowStepSequence_1.FlowStepSequence();
    newSeq1.name = "Test 2";
    newSeq1.desiredX = 500;
    newSeq1.desiredY = 100;
    newSeq1.strategy = FlowSequenceCompleteStrategy_1.FlowSequenceCompleteStrategy.LINK;
    newSeq1.addStep(new MultiOutputTestStep_1.MultiOutputTestStep());
    flow.addSequence(newSeq1);
    // multiple output step
    let multipleStep = flow.sequences[0].steps[1];
    // set sencond path as branch and connect it to new sequence, first path is continue.
    let secondPathForMultipleStep = multipleStep.getOutcomeInstructions()[1];
    secondPathForMultipleStep.strategy = FlowStepOutputInstructions_1.FlowStepOutputInstructionType.BRANCH;
    secondPathForMultipleStep.connectedSequenceId = newSeq._id;
    let thirdPathForMultipleStep = multipleStep.getOutcomeInstructions()[2];
    thirdPathForMultipleStep.strategy = FlowStepOutputInstructions_1.FlowStepOutputInstructionType.BRANCH;
    thirdPathForMultipleStep.connectedSequenceId = newSeq1._id;
    return flow;
}
exports.getFlowWithMultipleSequences = getFlowWithMultipleSequences;
function getFlowWithBranch() {
    let flow = new FlowConfiguration_1.FlowConfiguration();
    flow.sequences[0].strategy = FlowSequenceCompleteStrategy_1.FlowSequenceCompleteStrategy.LINK;
    return flow;
}
exports.getFlowWithBranch = getFlowWithBranch;
//# sourceMappingURL=TestDataSetup.js.map