{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mahastrategies-com/json-schema/mahastrategies-com-audit-job-schema.json",
  "title": "AuditJob",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mahastrategies-com-openapi.json#/components/schemas/AuditJob",
  "type": "object",
  "required": [
    "auditId",
    "clientRequestId",
    "inputHash",
    "status",
    "idempotentReplay",
    "capability",
    "sourceTextStored"
  ],
  "properties": {
    "auditId": {
      "type": "string",
      "pattern": "^audit_[a-f0-9]{32}$"
    },
    "clientRequestId": {
      "type": "string"
    },
    "inputHash": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "processing",
        "completed",
        "failed"
      ]
    },
    "idempotentReplay": {
      "type": "boolean"
    },
    "capability": {
      "type": "string",
      "const": "mps_audit"
    },
    "sourceTextStored": {
      "type": "boolean",
      "const": false,
      "description": "Source text is never retained; only its hash."
    },
    "audit": {
      "$ref": "#/$defs/AuditResult"
    },
    "retryAfterSeconds": {
      "type": "integer",
      "description": "Present while status is `processing`."
    },
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "description": "Present when status is `failed`."
    }
  },
  "$defs": {
    "AuditClaim": {
      "type": "object",
      "required": [
        "excerpt",
        "tag",
        "rationale",
        "action"
      ],
      "properties": {
        "excerpt": {
          "type": "string",
          "description": "Verbatim excerpt from the passage (6–25 words)."
        },
        "tag": {
          "type": "string",
          "enum": [
            "VERIFIED",
            "SOURCED",
            "BOUNDARY",
            "ILLUSTRATIVE",
            "UNVERIFIED"
          ]
        },
        "rationale": {
          "type": "string",
          "maxLength": 1000
        },
        "action": {
          "type": "string",
          "enum": [
            "none",
            "verify",
            "cite",
            "reword",
            "remove"
          ]
        }
      }
    },
    "AuditResult": {
      "type": "object",
      "required": [
        "mps_version",
        "input_hash",
        "claims"
      ],
      "properties": {
        "mps_version": {
          "type": "string",
          "const": "0.1"
        },
        "input_hash": {
          "type": "string",
          "description": "SHA-256 of the audited passage."
        },
        "claims": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AuditClaim"
          }
        }
      }
    }
  }
}