{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oxyon.io/xl1/api/v1/head.schema.json",
  "title": "oxyon.xl1.api.head.v1",
  "description": "Stable v1 contract for GET /api/xl1/v1/{net}/head. Fields listed are promised; others may appear (additive changes only).",
  "type": "object",
  "required": [
    "meta",
    "net",
    "head",
    "blockTime",
    "producers",
    "pace"
  ],
  "properties": {
    "net": {
      "enum": [
        "sequence",
        "mainnet"
      ]
    },
    "head": {
      "type": "object",
      "required": [
        "n",
        "hash",
        "producer",
        "epoch",
        "txs"
      ],
      "properties": {
        "n": {
          "type": "integer",
          "minimum": 0
        },
        "hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "producer": {
          "type": "string",
          "pattern": "^[0-9a-f]{40}$"
        },
        "epoch": {
          "type": "integer",
          "minimum": 0
        },
        "txs": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": true
    },
    "blockTime": {
      "type": "object",
      "required": [
        "meanMs",
        "medianMs",
        "sample"
      ],
      "properties": {
        "meanMs": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "medianMs": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "sample": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": true
    },
    "producers": {
      "type": "object",
      "required": [
        "active10m",
        "active1h"
      ],
      "properties": {
        "active10m": {
          "type": "integer",
          "minimum": 0
        },
        "active1h": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": true
    },
    "pace": {
      "type": "object",
      "required": [
        "last10m",
        "last1h"
      ],
      "properties": {
        "last10m": {
          "type": "integer",
          "minimum": 0
        },
        "last1h": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": true
    },
    "meta": {
      "type": "object",
      "required": [
        "net",
        "source",
        "generatedAt",
        "apiVersion",
        "schema"
      ],
      "properties": {
        "net": {
          "enum": [
            "sequence",
            "mainnet"
          ]
        },
        "source": {
          "enum": [
            "official",
            "observed",
            "derived",
            "telemetry",
            "rpc"
          ]
        },
        "generatedAt": {
          "type": "integer",
          "minimum": 0
        },
        "apiVersion": {
          "const": 1
        },
        "schema": {
          "const": "oxyon.xl1.api.head.v1"
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
