{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://yougrow.ai/developers/schema/batch-response.json",
  "title": "Batch response",
  "description": "What POST /api/v2/users/batch returns with 200: how many users were applied, ignored and failed, and which ones weren't applied.",
  "type": "object",
  "properties": {
    "applied": {
      "type": "integer"
    },
    "ignored": {
      "type": "integer"
    },
    "failed": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer"
          },
          "userId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "applied",
              "ignored",
              "failed"
            ]
          },
          "reason": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "message"
              ]
            }
          }
        },
        "required": [
          "index",
          "userId",
          "status",
          "reason"
        ]
      }
    }
  },
  "required": [
    "applied",
    "ignored",
    "failed",
    "results"
  ]
}
