{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://yougrow.ai/developers/schema/context-request.json",
  "title": "Context request",
  "description": "What YouGrow POSTs to your context endpoint about one user.",
  "type": "object",
  "properties": {
    "userId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "purpose": {
      "type": "string",
      "enum": [
        "send",
        "prepare",
        "condition",
        "test"
      ]
    },
    "journeyId": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ]
    },
    "nodeId": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ]
    },
    "entity": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "maxLength": 128
            },
            "kind": {
              "type": "string",
              "maxLength": 40
            }
          },
          "required": [
            "id",
            "kind"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "requestId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    }
  },
  "required": [
    "userId",
    "purpose",
    "requestId"
  ]
}
