{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.driftframe.org/site-reading-governance/v2.0/language-control.schema.json",
  "title": "High-consequence Language Control",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "control_id",
    "consequence_class",
    "target_state",
    "boundary",
    "replacement_behavior",
    "verification",
    "owner_role",
    "evidence",
    "metadata"
  ],
  "properties": {
    "control_id": {
      "$ref": "common.schema.json#/$defs/identifier"
    },
    "consequence_class": {
      "type": "string",
      "enum": [
        "safety",
        "privacy",
        "security",
        "quality",
        "regulatory",
        "production"
      ]
    },
    "target_state": {
      "type": "string",
      "minLength": 20,
      "maxLength": 700
    },
    "boundary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "protected_state",
        "explicit_constraint"
      ],
      "properties": {
        "protected_state": {
          "type": "string",
          "minLength": 10,
          "maxLength": 500
        },
        "explicit_constraint": {
          "type": "string",
          "minLength": 10,
          "maxLength": 500
        }
      }
    },
    "replacement_behavior": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "trigger",
        "safe_action",
        "recovery_route"
      ],
      "properties": {
        "trigger": {
          "type": "string",
          "minLength": 10,
          "maxLength": 500
        },
        "safe_action": {
          "type": "string",
          "minLength": 10,
          "maxLength": 700
        },
        "recovery_route": {
          "type": "string",
          "minLength": 10,
          "maxLength": 700
        }
      }
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "success_criteria",
        "check_ids"
      ],
      "properties": {
        "method": {
          "type": "string",
          "minLength": 10,
          "maxLength": 700
        },
        "success_criteria": {
          "type": "string",
          "minLength": 10,
          "maxLength": 700
        },
        "check_ids": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "$ref": "common.schema.json#/$defs/identifier"
          }
        }
      }
    },
    "owner_role": {
      "type": "string",
      "minLength": 3,
      "maxLength": 120
    },
    "evidence": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "common.schema.json#/$defs/artifact"
      }
    },
    "metadata": {
      "$ref": "common.schema.json#/$defs/recordMetadata"
    }
  }
}
