{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.samirac.com/schemas/test-vector.schema.json",
  "title": "SAQ Execution Contract Test Vector",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "vector_id",
    "title",
    "polarity",
    "stage",
    "evaluation_time",
    "input",
    "expected"
  ],
  "properties": {
    "vector_id": {
      "$ref": "common-definitions.schema.json#/$defs/identifier"
    },
    "title": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "type": "string"
    },
    "polarity": {
      "type": "string",
      "enum": [
        "POSITIVE",
        "NEGATIVE"
      ]
    },
    "stage": {
      "type": "string",
      "enum": [
        "ADMISSIBILITY_EVALUATION",
        "GRANT_VERIFICATION",
        "RECEIPT_VALIDATION"
      ]
    },
    "evaluation_time": {
      "type": "string",
      "format": "date-time"
    },
    "input": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "contract"
      ],
      "properties": {
        "contract": {
          "$ref": "execution-contract.schema.json"
        },
        "grant": {
          "$ref": "execution-grant.schema.json"
        },
        "receipt": {
          "$ref": "execution-receipt.schema.json"
        },
        "runtime_context": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "consumed_nonces": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "uniqueItems": true
            },
            "revoked_grant_ids": {
              "type": "array",
              "items": {
                "$ref": "common-definitions.schema.json#/$defs/identifier"
              },
              "uniqueItems": true
            },
            "grant_usage_count": {
              "type": "integer",
              "minimum": 0
            }
          }
        }
      }
    },
    "expected": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "result",
        "reason_codes"
      ],
      "properties": {
        "result": {
          "type": "string",
          "enum": [
            "ADMISSIBLE",
            "CONDITIONAL",
            "DENIED",
            "DEFERRED",
            "EXPIRED",
            "EXECUTION_PERMITTED",
            "RECEIPT_ACCEPTED",
            "CORRECTION_REQUIRED"
          ]
        },
        "next_state": {
          "$ref": "common-definitions.schema.json#/$defs/lifecycleState"
        },
        "reason_codes": {
          "type": "array",
          "items": {
            "$ref": "common-definitions.schema.json#/$defs/reasonCode"
          },
          "uniqueItems": true
        },
        "execution_permitted": {
          "type": "boolean"
        },
        "correction_required": {
          "type": "boolean"
        }
      }
    }
  }
}
