{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://gxplex.com/api/v1/schema/probe.json",
  "title": "Probe partition index document",
  "description": "The document served at /api/v1/probe.json. Items are carried under `partitions`.",
  "type": "object",
  "properties": {
    "partitions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/item"
      },
      "description": "Every probe partition index this document carries."
    }
  },
  "required": [
    "partitions"
  ],
  "additionalProperties": true,
  "$defs": {
    "item": {
      "type": "object",
      "title": "Probe partition index",
      "description": "Names every partition of the bot-probe series, its state and its size, so a consumer discovers the series without guessing addresses.",
      "properties": {
        "window": {
          "type": "string",
          "description": "The ISO week the partition covers."
        },
        "state": {
          "type": "string",
          "enum": [
            "open",
            "closed"
          ],
          "description": "`open` is the current week and still receiving rows."
        },
        "url": {
          "type": "string",
          "description": "The partition address."
        },
        "rows": {
          "type": "integer",
          "description": "Rows in the partition."
        },
        "first_probe": {
          "type": "string",
          "format": "date",
          "description": "Earliest probe day in the partition."
        },
        "last_probe": {
          "type": "string",
          "format": "date",
          "description": "Latest probe day in the partition."
        }
      },
      "required": [
        "window",
        "state",
        "url",
        "rows"
      ],
      "additionalProperties": true
    }
  }
}
