{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/spicrawl-com/json-schema/spicrawl-com-fleet-list-schema.json",
  "title": "FleetList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/spicrawl-com-fleet-api-openapi.yml#/components/schemas/FleetList",
  "type": "object",
  "required": [
    "kinds"
  ],
  "properties": {
    "kinds": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FleetKind"
      },
      "description": "One entry per worker kind, in the fixed order browser, egress, extract, batch, including kinds with no workers."
    }
  },
  "$defs": {
    "FleetKind": {
      "type": "object",
      "required": [
        "kind",
        "present",
        "ready",
        "workers"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "browser",
            "egress",
            "extract",
            "batch"
          ],
          "description": "Worker type."
        },
        "present": {
          "type": "integer",
          "minimum": 0,
          "description": "Workers of this kind currently publishing. 0 means none are running."
        },
        "ready": {
          "type": "integer",
          "minimum": 0,
          "description": "Of those, how many accept work. 0 means work of this kind will queue or fail."
        },
        "workers": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FleetWorker"
          },
          "description": "The workers. Empty array when none."
        }
      }
    },
    "FleetWorker": {
      "type": "object",
      "required": [
        "worker_id",
        "kind",
        "capacity",
        "in_flight",
        "free_slots",
        "ready",
        "address",
        "last_seen_ms"
      ],
      "properties": {
        "worker_id": {
          "type": "string",
          "description": "Worker instance id."
        },
        "kind": {
          "type": "string",
          "enum": [
            "browser",
            "egress",
            "extract",
            "batch"
          ],
          "description": "Worker type."
        },
        "capacity": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295,
          "description": "Concurrent tasks the worker accepts."
        },
        "in_flight": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295,
          "description": "Tasks it is running now."
        },
        "free_slots": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295,
          "description": "Capacity minus in-flight, floored at 0."
        },
        "ready": {
          "type": "boolean",
          "description": "Whether the worker accepts new work."
        },
        "detail": {
          "type": "string",
          "description": "Worker's own readiness note, e.g. why it is not ready. Absent when empty."
        },
        "task_stream": {
          "type": "string",
          "description": "Queue the worker consumes. Absent when none."
        },
        "address": {
          "type": "string",
          "description": "Address the API dials. Empty string means the worker is listed but receives no registry traffic."
        },
        "last_seen_ms": {
          "type": "integer",
          "format": "int64",
          "description": "Milliseconds since the worker last published. Large values mean it may be gone. Can be slightly negative under clock skew."
        }
      }
    }
  }
}