info:
  name: Voce indice fascicolazione
  type: http
  seq: 5

http:
  method: POST
  url: "{{elixFormsApiUrl}}/eftl/process/v1"
  headers:
    - name: x-requested-with
      value: XMLHttpRequest
    - name: x-api-key
      value: "{{elixFormsWsAuthenticationToken}}"
    - name: x-ef-request-id
      value: "17144"
      disabled: true
    - name: x-ef-request-id
      value: "25889"
  body:
    type: json
    data: |-
      {
        "userDocument": "{{elixBase64EftlDocument}}", // see the pre-request script
        "userContext": {
          "lang": "IT"
        }
      }
  auth: inherit

runtime:
  scripts:
    - type: before-request
      code: |-
        const { prepareEftlDocument } = require("./elixFormsJs.js")
        // Copy-pasta your EFTL document below inside the template literals (`)
        prepareEftlDocument(String.raw`
        [EFTL][HEADER name="trimDocument" value="true" type="boolean" /]
        [VAR name="tipologiaCodice" type="string"][TAG]GETVALUEBYTAG,TIPOLOGIA_CODICE,REQUEST,IUQOID[/TAG][/VAR]
        [VAR name="suffissoVoceIndice" type="string"][% suffissoVoceIndice = "Contratti"; %][/VAR]
        [VAR name="tipologieContoTerzi" type="iterable"][SPLIT regex=";"][TAG]GETVALUEBYTAG,TIPOLOGIE_VOCE_INDICE_CONTOTERZI,REQUEST,IUQOID[/TAG][/SPLIT][/VAR]

        [IF]
          [CONDITION]
            [CONTAINS varname="tipologieContoTerzi"][VALUE_OF varname="tipologiaCodice" /][/CONTAINS]
          [/CONDITION]
          [THEN][% suffissoVoceIndice = "ContoTerzi"; %][/THEN]
        [/IF]

        [%= suffissoVoceIndice %]
        [/EFTL]
        `);

settings:
  encodeUrl: true
  timeout: 0
  followRedirects: true
  maxRedirects: 5
  forwardAuthorizationHeader: true
