{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "vaultfire://v3-operations/role-control.schema.json",
  "title": "Vaultfire V3 role separation and lifecycle controls",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "roles",
    "separationRules",
    "keyLifecycle",
    "recusalAndConflict",
    "responderCoverage"
  ],
  "properties": {
    "schemaVersion": {"const": "1.0.0"},
    "roles": {
      "type": "array",
      "minItems": 9,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "purpose", "threshold", "members", "assignmentStatus"],
        "properties": {
          "id": {
            "enum": [
              "owner",
              "governance",
              "guardian",
              "treasury",
              "attesters",
              "adjudicators",
              "release-attester",
              "incident-responders",
              "reconciliation-responders"
            ]
          },
          "purpose": {"type": "string", "minLength": 1},
          "threshold": {
            "type": "object",
            "additionalProperties": false,
            "required": ["minimum", "populationMinimum"],
            "properties": {
              "minimum": {"type": "integer", "minimum": 1},
              "populationMinimum": {"type": "integer", "minimum": 1}
            }
          },
          "members": {
            "type": "array",
            "items": {"type": "string", "pattern": "^subject:[a-z0-9][a-z0-9._-]*$"},
            "uniqueItems": true
          },
          "assignmentStatus": {"enum": ["unassigned-blocking", "evidenced"]}
          ,"binding": {"enum": ["governance-contract"]}
        }
      }
    },
    "separationRules": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["left", "right", "overlapAllowed"],
        "properties": {
          "left": {"type": "string"},
          "right": {"type": "string"},
          "overlapAllowed": {"const": false}
        }
      },
      "minItems": 6
    },
    "keyLifecycle": {"type": "object"},
    "recusalAndConflict": {"type": "object"},
    "responderCoverage": {"type": "object"}
  }
}
