key: processExample1
type: process
name: Start Recruitment
icon: person
mainTable: invitation
summary:
  title: Process for {{candidate.name}}
permissions:
  recruiter: true
  employee:
    start: true
    pause:
      own: true
    archive: false

  manager:
    start: true
    pause: true
fieldGroups:
  summary:
    readOnly: true
    rows:
      - [candidate, position]
      - comments

  anotherGroup:
    rows:
      - _group: summaryWithScores

  summaryWithScores:
    readOnly: true
    rows:
      - _group: summary
      - candidate.scores
forms:

  fillOutInvitationInformation:
    name: Start application
    rows:
      - candidate.name
      - candidate.email
      - candidate.phoneNumber
      - [position: {readOnly: true}, comments]

  fillOutScores:
    name: Fill out scores
    title: Fill out scores for {{candidate.name}} - {{candidate.email}}

    rows:
      - _group: summary
      - _title: Scores
      - _statement: Please enter the candidate scores
      - iqScore
      - englishScore
      - handsOnScore

  manualApproval1:
    name: Manual Approval 1
    rows:
      - _group: summaryWithScores
      - approvalComments:
          readOnly: true
    outcomes:
      approve: Approve
      reject:
        title: Reject
        form:
          rows:
            - rejectReason
            - _group: summary
serviceTasks:
  calculateScore:
    name: Calculate score
    type: httpRequest
    retries: 3
    method: POST
    url: http://example.com/myEndpoint/{{candidate.email}}
    query:
      a: any text
      b: "{{candidate.id}}"
      d: "{{_secrets.mySecret}}"
      e: "{{_vars.initiator.id}}"
      f: A mix of anything {{_vars.initiator.email}} {{_secrets.abc}}
      g: "{{candidate.phoneNumber.extension}}"
    headers:
      Authorization: Bearer {{_secrets.myToken}}
    body:
      myKey: myValue
      anotherKey: "{{_secrets.mySecret}}"
    mapping:
      _vars.response: "{{body}}"
      candidate.finalScore: "{{body.data.score}}"
      _vars.statusCode: "{{statusCode}}"
      _vars.expireDate: "{{headers.expires}}"
