{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mioroute.com/lab-continuity-cards.schema.json",
  "title": "mioroute Lab continuity cards",
  "description": "Public-safe machine-readable continuity cards derived from https://mioroute.com/lab-index.json. Each card exposes only public Lab metadata, route-level questions, check doors, and a bounded stop rule.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schema",
    "generated_from",
    "generated_at",
    "owner",
    "boundary",
    "source_index_schema",
    "source_index_generated_at",
    "card_count",
    "route_counts",
    "cards"
  ],
  "properties": {
    "$schema": {"const": "https://mioroute.com/lab-continuity-cards.schema.json"},
    "schema": {"const": "mioroute.lab-continuity-cards.v1"},
    "generated_from": {"const": "https://mioroute.com/lab-index.json"},
    "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": 120,
      "pattern": "Public-safe continuity cards derived only from the served Lab index"
    },
    "source_index_schema": {"const": "mioroute.lab-index.v1"},
    "source_index_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$"
    },
    "card_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}
      }
    },
    "cards": {
      "type": "array",
      "items": {"$ref": "#/$defs/card"}
    }
  },
  "$defs": {
    "routeBucket": {
      "type": "string",
      "enum": [
        "evidence-evaluation",
        "judgment-adoption",
        "memory-continuity",
        "public-contact-rhythm",
        "tools-boundaries",
        "workflow-runtime"
      ]
    },
    "card": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "title",
        "url",
        "date",
        "tag",
        "primary_route",
        "routes",
        "decision_delta",
        "continuity_question",
        "check_doors",
        "stop_rule"
      ],
      "properties": {
        "id": {"type": "string", "pattern": "^[a-z0-9-]+$"},
        "title": {"type": "string", "minLength": 1},
        "url": {"type": "string", "pattern": "^https://mioroute\\.com/lab/[a-z0-9-]+$"},
        "date": {"type": "string", "pattern": "^20[0-9]{2}-[0-9]{2}-[0-9]{2}$"},
        "tag": {"type": "string", "minLength": 1},
        "primary_route": {"$ref": "#/$defs/routeBucket"},
        "routes": {
          "type": "array",
          "minItems": 1,
          "items": {"$ref": "#/$defs/routeBucket"},
          "uniqueItems": true
        },
        "decision_delta": {
          "type": "string",
          "minLength": 40,
          "maxLength": 220,
          "pattern": "^Use when [^\\n]+: apply the .+ gate to decide whether to proceed, hold, or discard\\.$"
        },
        "continuity_question": {"type": "string", "minLength": 20, "maxLength": 140},
        "check_doors": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {"type": "string", "minLength": 10, "maxLength": 140}
        },
        "stop_rule": {"type": "string", "minLength": 40, "maxLength": 180}
      }
    }
  }
}
