{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mobster.dev/schema/webhooks/needs_you.json",
  "title": "A task needs you",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "type",
    "runId",
    "kind",
    "question",
    "askedAt",
    "workflow",
    "text"
  ],
  "properties": {
    "type": {
      "const": "needs_you",
      "description": "The event, as the Mobster-Event header names it."
    },
    "runId": {
      "type": "string",
      "description": "The task's id."
    },
    "kind": {
      "enum": [
        "approval",
        "question",
        "plan"
      ]
    },
    "question": {
      "type": "string",
      "description": "What the card asks, as Mobster shows it, masked."
    },
    "askedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "UTC, ISO 8601. Null when unknown."
    },
    "workflow": {
      "anyOf": [
        {
          "type": "object",
          "description": "The workflow the task ran from. Null for a task you started yourself.",
          "additionalProperties": false,
          "required": [
            "id",
            "name",
            "blanks"
          ],
          "properties": {
            "id": {
              "type": [
                "string",
                "null"
              ],
              "description": "The workflow's id."
            },
            "name": {
              "type": "string",
              "description": "The workflow's name."
            },
            "blanks": {
              "type": "object",
              "description": "Each blank's value, by the blank's name."
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "text": {
      "type": "string",
      "description": "One line for chat tools: Mobster: …, or Mobster › <workflow>: …"
    },
    "answerUrl": {
      "type": "string",
      "format": "uri",
      "description": "Only with passkey approvals on, for a send, buy, post or delete on one of your team's Macs: the team console page that answers it with a passkey. It holds the team's, the Mac's, the task's and the approval's ids and approves nothing by itself. text ends with it."
    }
  }
}
