import MCA from '../../../enum/dc/mcaButtons'; import scenarioContext from '../../../util/scenarioContext'; import { dcAmendmentMcaFlow, dcIssuanceMcaFlow } from './McaFlows'; const McaAction = { dcIssuanceMcaFlow: dcIssuanceMcaFlow, dcAmendmentMcaFlow: dcAmendmentMcaFlow }; export async function populateMCAWorkflows( party: string, type: string, nextParty: string, mcaType: string, scenario: string ) { const dcRef = scenarioContext().dc.uuid.substring(0, 8); const mcaOne = [ `checker-${MCA.DECLINE}`, `maker-${MCA.UPDATE}`, `checker-${MCA.VERIFY}`, `approver-${MCA.DECLINE}`, `maker-${MCA.UPDATE}`, `checker-${MCA.VERIFY}`, `approver-${MCA.APPROVE}` ]; const mcaTwo = [ `approver-${MCA.DECLINE}`, `maker-${MCA.UPDATE}`, `checkerApprover-${MCA.DECLINE}`, `admin1-${MCA.UPDATE}` ]; const mcaFlow = mcaType == 'mca1' ? mcaOne : mcaTwo; await selectMcaAction(party, type, nextParty, dcRef, mcaFlow, scenario); } async function selectMcaAction( party: string, type: string, nextParty: string, dcReference: string, action: string[], scenario: string ) { if (type === 'dc') { await McaAction.dcIssuanceMcaFlow(party, dcReference, action, scenario); } else if (type === 'draft' || type === 'draftAmendment') { await McaAction.dcAmendmentMcaFlow(party, type, nextParty, dcReference, action, scenario); } }