{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.samirac.com/schemas/reason-code.schema.json",
  "title": "SAQ Reason Code Definition",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "code",
    "category",
    "severity",
    "default_disposition",
    "message",
    "remediation",
    "retryable",
    "terminal"
  ],
  "properties": {
    "code": {
      "$ref": "common-definitions.schema.json#/$defs/reasonCode"
    },
    "category": {
      "type": "string",
      "enum": [
        "CONTRACT",
        "IDENTITY",
        "AUTHORITY",
        "STATE",
        "EVIDENCE",
        "POLICY",
        "RISK",
        "CONSTRAINT",
        "ADMISSIBILITY",
        "GRANT",
        "EXECUTION",
        "RECEIPT",
        "CORRECTION",
        "SYSTEM"
      ]
    },
    "severity": {
      "type": "string",
      "enum": [
        "INFO",
        "WARNING",
        "ERROR",
        "CRITICAL"
      ]
    },
    "default_disposition": {
      "type": "string",
      "enum": [
        "ALLOW",
        "CONDITION",
        "DENY",
        "ESCALATE",
        "DEFER",
        "EXPIRE",
        "REVOKE",
        "CORRECT",
        "FAIL"
      ]
    },
    "message": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1000
    },
    "remediation": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "retryable": {
      "type": "boolean"
    },
    "terminal": {
      "type": "boolean"
    },
    "extensions": {
      "type": "object",
      "additionalProperties": true
    }
  }
}
