{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schemas.apps.smartmate.io/processes/serviceTasks/_base/_baseServiceTask.schema.json",
  "$$target": "https://schemas.apps.smartmate.io/processes/serviceTasks/_base/_baseServiceTask.schema.json",
  "type": "object",
  "title": "serviceTask _base",
  "description": "Common attributes of all :ref:`service tasks <service-tasks>` defined in the process YAML file.",
  "properties": {
    "name": {
      "$ref": "https://schemas.apps.smartmate.io/patterns/name.schema.json",
      "description": "Service task name"
    },
    "retries": {
      "type": "number",
      "description": "How many times should the service be retried if fail."
    },
    "mapping": {
      "type": "object",
      "description": "How to map the results of the service task into fields or variables.",
      "examples": [
        {
          "myUserField": "{{_vars.initiator.id}}",
          "anotherField": "Lorem ipsum {{_vars.anotherVar}}",
          "yetAnotherField": "{{myField.relatedField.anotherValue}}",
          "myRel.myField": "{{_vars.yetAnotherVar}}",
          "_vars.myVar": 1234,
          "_vars.anotherVar": true
        }
      ],
      "propertyNames": {
        "type": "string",
        "pattern": "^[a-zA-Z0-9_.]+$",
        "description": "The name of the field or variable to store the result."
      },
      "patternProperties": {
        "": {
          "description": "Value can be any text, you can reference variables or fields using double braces. (See the examples above).",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            }
          ]
        }
      }
    }
  },
  "required": ["name"]
}
