info:
  name: Richiedente - Check ruolo per compilazione
  type: http
  seq: 1

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: "24281"
  body:
    type: json
    data: |-
      {
        "userDocument": "{{elixBase64EftlDocument}}", // see the pre-request script
        "userContext": {
          "lang": "IT",
          "crlf": "\r\n",
          "codiciRuoloPersonaleDocente": ";PA;PO;PD;RU;PF;"
        }
      }
  auth: inherit

runtime:
  scripts:
    - type: before-request
      code: |-
        // Copy-pasta your EFTL document below inside the template literals (`)
        var eftlDocumentToBeProcessed = bru.setVar("elixBase64EftlDocument", btoa(String.raw`
        [EFTL][HEADER name="trimDocument" value="true" type="boolean" /]

        [VAR name="checkPersonaleDocente" type="string"][% checkPersonaleDocente = ""; %][/VAR]
        [VAR name="richiedenteRuolo" type="string"][TAG]GETVALUEBYTAG,RUOLO_DIPENDENTE,REQUEST,IUQOID[/TAG][/VAR]

        [IF]
            [CONDITION][CONTAINS varname="codiciRuoloPersonaleDocente"][VALUE_OF varname="richiedenteRuolo" /][/CONTAINS][/CONDITION]
            [THEN][% checkPersonaleDocente = "Il personale docente non deve inserire le ore di attività"; %][/THEN]
        [/IF]

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

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