key: processExample1
type: process
name: Start Recruitment
icon: person
mainTable: Recruiters
summary:
  title: Process for {{fullName}}
permissions:
  recruiter: true
fieldGroups:
  summary:
    readOnly: true
    rows:
      - [identificationDocumentType, fullName]
  summaryWithScores:
    readOnly: true
    rows:
      - identificationDocumentType
forms:
  fillOutInvitationInformation:
    name: Start application
    rows:
      - identificationDocumentType
      - fullName
      - _html: |
          <p>This is a valid HTML snippet</p>
          <p>This is a valid HTML snippet</p>
  fillOutScores:
    name: Fill out scores
    title: Fill out scores for {{fullName}}
    rows:
      - _group: summary
      - _title: Scores
      - _statement: Please enter the candidate scores
      - identificationDocumentType
  manualApproval1:
    name: Manual Approval 1
    rows:
      - _group: summaryWithScores
      - identificationDocumentType
    outcomes:
      approve: Approve
      reject:
        title: Reject
        form:
          rows:
            - identificationDocumentType
# Defines the service tasks used by this process
serviceTasks:

  # the service task has an id, which should follow the identification pattern
  calculateScore:

    # name: determines the name of the form. It should follow the guidelines of a name
    # string, optional
    name: Calculate score

    # type: Determines the type of service task.
    # string, follows the rules of an identifier
    type: httpRequest

    # retries: Number of times to retry
    # optional, number
    retries: 3

    # PROPERTIES SPECIFIC TO "httpRequest" service task

    # method: Defines the method to use
    # string, required. Can be any of GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD
    method: POST

    # url: The URL
    # string, required
    url: http://example.com/myEndpoint/{{fullName}}

    # query: Key/Value pairs for the query string
    # object, optional
    query:

      # the key of this object can be any text
      # the value can be any:
      # - text
      # - field - {{fullName}}
      # - variable - {{_vars.initiator.email}}
      # - secret - {{_secrets.mySecret}}
      # - a mix of them
      a: any text
      b: "{{fullName}}"
      d: "{{_secrets.mySecret}}"
      e: "{{_vars.initiator.id}}"
      f: A mix of anything {{_vars.initiator.email}}

    # headers: key/value pairs of the headers to be sent to the request
    # object, optional
    headers:

      # the key of this object can be any text
      # the value can be any text, field, variable, secret or a mix of them
      Authorization: Bearer {{_secrets.secretOne}}

    # Body: The body to be sent in the HTTP Request.
    # optional, can be either:
    # - a string
    # - an object
    #
    # if body is a string, it can be multiline, and can include any fields, variables, secrets.
    # body: this is the body to be sent {{fullName}}
    #
    # if body is an object, the object properties will be sent as form data
    body:

      myKey: myValue
      anotherKey: "{{_secrets.secretFour}} {{_vars.mySecret}}"

    # mapping: Configures how the result will be processed
    # object, optional
    mapping:

      _vars.response: "{{body}}"
      identificationDocumentType: "{{body.data.score}}"
      _vars.statusCode: "{{statusCode}}"
      _vars.expireDate: "{{headers.expires}}"
