{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://legalquants.example/schemas/conform-mapping-response-1.0.0.json",
  "title": "Conform Mapping Worker Response",
  "description": "One mapping-stage worker's response to a bounded mapping packet. Proposal-only; the supervisor reconciles it into a canonical mapping record.",
  "type": "object",
  "additionalProperties": false,
  "required": ["packet", "rows"],
  "properties": {
    "packet": { "type": "integer", "minimum": 1 },
    "rows": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/row" }
    }
  },
  "$defs": {
    "row": {
      "type": "array",
      "prefixItems": [
        { "type": "integer", "minimum": 1, "description": "item_ordinal" },
        {
          "enum": [
            "equivalent",
            "narrower_scope",
            "broader_scope",
            "false_friend",
            "one_to_many",
            "many_to_one",
            "no_mapping",
            "leakage_flag",
            "needs_review",
            "insufficient_evidence"
          ],
          "description": "decision"
        },
        {
          "type": "array",
          "items": { "$ref": "#/$defs/evidence_ref" },
          "description": "evidence, drawn from the source and/or core context pool supplied in the packet"
        },
        {
          "type": "string",
          "maxLength": 2000,
          "description": "reviewer_note"
        }
      ],
      "items": false,
      "minItems": 4,
      "maxItems": 4
    },
    "evidence_ref": {
      "type": "array",
      "prefixItems": [
        { "enum": ["source", "core"], "description": "document_role" },
        { "type": "integer", "minimum": 0, "description": "context_pool ordinal" },
        { "enum": ["supports", "contradicts", "context"], "description": "stance" }
      ],
      "items": false,
      "minItems": 3,
      "maxItems": 3
    }
  }
}
