{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://antecant.com/assets/mandate.schema.json",
  "title": "Antecant mandate — reference contract",
  "description": "A draft reference contract. This is not a production API or authorization mechanism.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "id",
    "owner",
    "objective",
    "constraints",
    "budget",
    "authority",
    "acceptance"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0"
    },
    "id": {
      "type": "string",
      "pattern": "^MND-[A-Za-z0-9-]+$"
    },
    "owner": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "objective": {
      "type": "string",
      "minLength": 20,
      "maxLength": 4000
    },
    "constraints": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "budget": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "maximum_usd"
      ],
      "properties": {
        "maximum_usd": {
          "type": "number",
          "minimum": 0,
          "maximum": 1000000
        }
      }
    },
    "authority": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "allowed",
        "approval_required"
      ],
      "properties": {
        "allowed": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "approval_required": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        }
      }
    },
    "acceptance": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 10
      },
      "uniqueItems": true
    }
  }
}