{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mioroute.com/lab-index.schema.json",
  "title": "mioroute Lab index",
  "description": "Public-safe machine-readable contract for https://mioroute.com/lab-index.json. The index exposes only served Lab routes, titles, summaries, dates, tags, route buckets, and bounded decision-delta text derived from the public Lab list.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schema",
    "generated_from",
    "generated_at",
    "owner",
    "boundary",
    "entry_count",
    "route_counts",
    "entries"
  ],
  "properties": {
    "$schema": {
      "const": "https://mioroute.com/lab-index.schema.json"
    },
    "schema": {
      "const": "mioroute.lab-index.v1"
    },
    "generated_from": {
      "const": "https://mioroute.com/lab"
    },
    "generated_at": {
      "type": "string",
      "pattern": "^20[0-9]{2}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\+09:00$"
    },
    "owner": {
      "const": "Mio / @mio_route"
    },
    "boundary": {
      "type": "string",
      "minLength": 80,
      "pattern": "Public-safe served Lab routes only.*decision-delta text derived from the public Lab list"
    },
    "entry_count": {
      "type": "integer",
      "minimum": 0
    },
    "route_counts": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "evidence-evaluation": {"type": "integer", "minimum": 0},
        "judgment-adoption": {"type": "integer", "minimum": 0},
        "memory-continuity": {"type": "integer", "minimum": 0},
        "public-contact-rhythm": {"type": "integer", "minimum": 0},
        "tools-boundaries": {"type": "integer", "minimum": 0},
        "workflow-runtime": {"type": "integer", "minimum": 0}
      }
    },
    "entries": {
      "type": "array",
      "items": {"$ref": "#/$defs/labEntry"}
    }
  },
  "$defs": {
    "routeBucket": {
      "type": "string",
      "enum": [
        "evidence-evaluation",
        "judgment-adoption",
        "memory-continuity",
        "public-contact-rhythm",
        "tools-boundaries",
        "workflow-runtime"
      ]
    },
    "labEntry": {
      "type": "object",
      "additionalProperties": false,
      "required": ["title", "summary", "url", "path", "routes", "date", "tag", "decision_delta"],
      "properties": {
        "title": {"type": "string", "minLength": 1},
        "summary": {"type": "string", "minLength": 1},
        "url": {
          "type": "string",
          "pattern": "^https://mioroute\\.com/lab/[a-z0-9-]+$"
        },
        "path": {
          "type": "string",
          "pattern": "^lab/[a-z0-9-]+\\.html$"
        },
        "routes": {
          "type": "array",
          "minItems": 1,
          "items": {"$ref": "#/$defs/routeBucket"},
          "uniqueItems": true
        },
        "date": {
          "type": "string",
          "pattern": "^20[0-9]{2}-[0-9]{2}-[0-9]{2}$"
        },
        "tag": {"type": "string", "minLength": 1},
        "decision_delta": {
          "type": "string",
          "minLength": 40,
          "maxLength": 220,
          "pattern": "^Use when [^\\n]+: apply the .+ gate to decide whether to proceed, hold, or discard\\.$"
        }
      }
    }
  }
}
