info:
  name: Test vari
  type: http
  seq: 2

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: "22737"
      disabled: true
    - name: x-ef-request-id
      value: "22224"
      disabled: true
    - name: x-ef-request-id
      value: "22748"
      disabled: true
    - name: x-ef-request-id
      value: "22705"
      disabled: true
    - name: x-ef-request-id
      value: "22842"
  body:
    type: json
    data: |-
      {
        "userDocument": "{{elixBase64EftlDocument}}", // see the pre-request script
        "userContext": {
          "lang": "IT",
          "crlf": "\r\n",
          "qualificheDocenti": ";Docente;Ricercatore;",
          "complex": { 
            "antani": "tapioca",
            "array": [
              1, 2, 4
            ]
          }
        }
      }
  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="newLine" type="string"][VALUE_OF varname="crlf" /][/VAR]
        [VAR name="stringSeparated" type="string"][% stringSeparated = "xyz#abc#def"; %][/VAR]
        [VAR name="stringIterable" type="iterable"][SPLIT regex="#"][VALUE_OF varname="stringSeparated" /][/SPLIT][/VAR]

        [VAR name="stringJson" type="string"][TAG]SCHEMAID,405,COL0017,IUQOID, , [/TAG][/VAR]

        [VAR name="valoreT" type="string"][TAG]GETVALUEBYTAG,TEXTAREA_TAG,REQUEST,IUQOID[/TAG][/VAR]
        [VAR name="valoreS" type="string"][TAG]SCHEMAID,405,COL0003,IUQOID, , [/TAG][/VAR]

        [VAR name="valoreTag" type="number"][TAG]GETVALUEBYTAG,TEXTAREA_TAG,REQUEST,IUQOID,LAST,,0.00[/TAG][/VAR]
        [VAR name="valoreSch" type="number"][TAG]SCHEMAID,405,COL0003,IUQOID,,,,0.00[/TAG][/VAR]

        [VAR name="prodottoTag" type="number"][% prodotto = valoreTag * 0.20; %][/VAR]
        [VAR name="prodottoSch" type="number"][% prodotto = valoreSch * 0.20; %][/VAR]

        [%= valoreT " : " valoreS %]
        [%= newLine %]
        [%= valoreTag " : " valoreSch %]
        [%= newLine %]
        [%= prodottoTag " : " prodottoSch %]
        [%= newLine %]
        [%= stringIterable %]
        [%= newLine %]
        [%= complex %]
        [/EFTL]
        `);

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