{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/samva-dev/json-schema/samva-dev-journey-stats-schema.json",
  "title": "JourneyStats",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/samva-dev-journeys-api-openapi.yml#/components/schemas/JourneyStats",
  "type": "object",
  "properties": {
    "journeyId": {
      "$ref": "#/$defs/JourneyId"
    },
    "version": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "runs": {
      "$ref": "#/$defs/JourneyRunCounts"
    },
    "nodes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/JourneyNodeStats"
      }
    }
  },
  "required": [
    "journeyId",
    "version",
    "runs",
    "nodes"
  ],
  "additionalProperties": false,
  "$defs": {
    "JourneyId": {
      "type": "string",
      "pattern": "^jrny_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "JourneyId"
    },
    "JourneyNodeId": {
      "type": "string",
      "minLength": 1
    },
    "JourneyNodeStats": {
      "type": "object",
      "properties": {
        "nodeId": {
          "$ref": "#/$defs/JourneyNodeId"
        },
        "current": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "entered": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "nodeId",
        "current",
        "entered"
      ],
      "additionalProperties": false
    },
    "JourneyRunCounts": {
      "type": "object",
      "properties": {
        "active": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "paused": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "exited": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "failed": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "active",
        "paused",
        "exited",
        "failed"
      ],
      "additionalProperties": false
    }
  }
}