{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/geniusdecision-app/json-schema/geniusdecision-app-job-envelope-schema.json",
  "title": "JobEnvelope",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/geniusdecision-app-jobs-api-openapi.yml#/components/schemas/JobEnvelope",
  "type": "object",
  "properties": {
    "job": {
      "$ref": "#/$defs/Job"
    }
  },
  "required": [
    "job"
  ],
  "$defs": {
    "Job": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "case_id": {
          "type": "string"
        },
        "revision": {
          "type": "integer"
        },
        "status": {
          "enum": [
            "queued",
            "running",
            "completed",
            "failed",
            "cancelled",
            "interrupted"
          ]
        },
        "error": {
          "type": [
            "string",
            "null"
          ]
        },
        "created_at": {
          "type": "integer"
        },
        "started_at": {
          "type": [
            "integer",
            "null"
          ]
        },
        "finished_at": {
          "type": [
            "integer",
            "null"
          ]
        },
        "result": {
          "type": [
            "object",
            "null"
          ],
          "description": "Preserve the complete response envelope. See full documentation for RC01 semantics."
        },
        "result_json": {
          "type": [
            "string",
            "null"
          ],
          "description": "Original result JSON text; preserve exactly to avoid numeric rounding."
        },
        "admission": {
          "type": [
            "object",
            "null"
          ]
        },
        "artifacts": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "url": {
              "type": "string"
            },
            "sha256": {
              "type": "string"
            },
            "size": {
              "type": "integer"
            }
          }
        }
      },
      "required": [
        "id",
        "case_id",
        "revision",
        "status",
        "result",
        "result_json"
      ]
    }
  }
}