{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://standards.rootblocks.com/schemas/decisions/decision-record.v1.schema.json",
  "title": "RootBlocks DecisionRecord v1",
  "description": "Machine-readable contract for the SliceOps DecisionRecord (DEC) frontmatter — base frontmatter schema (Capa B.1) plus the Layer 1 consistency-management fields. Ported to executable form per DEC-007 (Standard v2) / ARC-002. Attribution: SliceOps spec reference/frontmatter-schemas (CC BY 4.0). additionalProperties is true by design: this validates the portable canonical subset; adopter dialects (e.g. rootblocks-engineering's name/description/type/confidentiality frontmatter) add fields under their own scope per base-schema.md and P8.",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "entity",
    "status",
    "created",
    "updated",
    "owner",
    "sensitivity",
    "originating_slice",
    "supersedes",
    "superseded-by",
    "conflicts-with",
    "related-decs",
    "topics",
    "vocabulary-changes",
    "consistency-check"
  ],
  "properties": {
    "entity": {
      "const": "DecisionRecord"
    },
    "status": {
      "enum": ["proposed", "ratified", "superseded", "deprecated"]
    },
    "created": {
      "type": "string",
      "format": "date"
    },
    "updated": {
      "type": "string",
      "format": "date"
    },
    "owner": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "sensitivity": {
      "enum": ["public", "internal", "restricted", "sensitive"]
    },
    "originating_slice": {
      "description": "P4 provenance: the slice that produced this DEC. null only for back-fill of pre-SliceOps decisions.",
      "oneOf": [
        { "$ref": "#/$defs/sliceId" },
        { "type": "null" }
      ]
    },
    "supersedes": {
      "type": "array",
      "items": { "$ref": "#/$defs/decId" }
    },
    "superseded-by": {
      "oneOf": [
        { "$ref": "#/$defs/decId" },
        { "type": "null" }
      ]
    },
    "conflicts-with": {
      "description": "DECs this could appear to contradict. Non-empty => body MUST include a Conflict Resolution section (enforced by process R-rules, not this schema).",
      "type": "array",
      "items": { "$ref": "#/$defs/decId" }
    },
    "related-decs": {
      "type": "array",
      "items": { "$ref": "#/$defs/decId" }
    },
    "topics": {
      "description": "Canonical topic taxonomy tags. Membership in the taxonomy is validated by process tooling, not this schema (ARC-002 §5 row 9).",
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "vocabulary-changes": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "consistency-check": {
      "description": "Layer 1 mandatory paragraph: how this DEC relates to the existing corpus.",
      "type": "string",
      "minLength": 1
    }
  },
  "$defs": {
    "decId": {
      "type": "string",
      "pattern": "^(DR-[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9][a-z0-9-]*|[A-Z]{2,6}-[0-9]{1,6})$"
    },
    "sliceId": {
      "type": "string",
      "pattern": "^BL-[0-9]{2,}(\\.SEC-[0-9]{2,})?\\.SL-[0-9]{3}[a-z]?$"
    }
  }
}
