{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://grip.foxora.dev/schema/1.0-draft.2/mandate.schema.json",
  "title": "GRIP Mandate",
  "description": "The Principal's signed statement of what is wanted, what it may cost, and who may issue authority against it. §4.3.1.",
  "allOf": [{ "$ref": "common.schema.json#/$defs/envelope" }],
  "type": "object",
  "required": ["grip", "type", "id", "iss", "iat", "exp", "sig", "goal", "acceptance", "budget", "issuers"],
  "properties": {
    "type": { "const": "mandate" },
    "parents": false,
    "goal": { "type": "string", "minLength": 1 },
    "constraints": { "type": "array", "items": { "type": "string" } },
    "scope": {
      "type": "array",
      "items": { "$ref": "common.schema.json#/$defs/allowEntry" },
      "description": "Optional machine-checkable authority ceiling in Grant-allow shape. Absent means the root hop is reported issuer-attested. §4.3.1."
    },
    "issuers": {
      "type": "array",
      "items": { "$ref": "common.schema.json#/$defs/keyref" },
      "minItems": 1,
      "uniqueItems": true,
      "description": "Key identities permitted to sign root Grants. Trust-bundle membership alone never suffices. §4.6 rule 3."
    },
    "acceptance": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["code", "check"],
        "properties": {
          "code": { "type": "string", "minLength": 1 },
          "check": { "type": "string", "minLength": 1 },
          "independent": { "type": "boolean", "default": false }
        },
        "additionalProperties": false
      }
    },
    "budget": { "$ref": "common.schema.json#/$defs/budget" }
  },
  "$comment": "scope entries in a Mandate omit 'class' in the paper's example; class is required in Grant allow entries. A Mandate scope entry MAY omit class, in which case it constrains verb and resource only."
}
