{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dpf-it-com/json-schema/dpf-it-com-get-status-by-job-id-response-schema.json",
  "title": "Get Status Response (queried by jobId)",
  "x-generated": "2026-11-06",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dpf-it-com-openapi.yml#/components/schemas/GetStatusByJobIdResponse",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "data": {
      "type": "object",
      "description": "The data_jobs record for this run — the Glue data-load execution.",
      "properties": {
        "jobId": {
          "type": "string",
          "format": "uuid"
        },
        "specId": {
          "type": "string",
          "format": "uuid",
          "description": "Associated spec ID"
        },
        "workspaceId": {
          "type": "string",
          "format": "uuid",
          "description": "Workspace ID"
        },
        "status": {
          "type": "string",
          "enum": [
            "ready",
            "processing",
            "complete",
            "failed"
          ],
          "description": "Current job status"
        },
        "currentLambda": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of the pipeline stage currently processing (or last processed):\n- `prepare-transformation`: AI inference and code generation (only if start-analysis triggered this job before this refactor; current jobs are only touched by data-load)\n- `data-load`: Data transformation and writing to Iceberg tables\n"
        },
        "statusMessage": {
          "type": "string",
          "description": "Human-readable status message"
        },
        "progress": {
          "type": "integer",
          "description": "Progress percentage (0-100)",
          "minimum": 0,
          "maximum": 100
        },
        "startTime": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Job start time (null if not started yet)"
        },
        "endTime": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Job end time (null if still running)"
        },
        "durationMs": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Job duration in milliseconds (null if still running)"
        },
        "metrics": {
          "$ref": "#/$defs/JobMetrics",
          "nullable": true,
          "description": "Job execution metrics (only present when status is complete)"
        },
        "error": {
          "type": [
            "string",
            "null"
          ],
          "description": "Error code (only present if status=failed). Possible values:\n- `DATA_LOAD_INVOCATION_ERROR`: Failed to start data-load job\n- `INSUFFICIENT_CREDITS`: Workspace owner lacked credits to run the job\n"
        },
        "errorDetails": {
          "type": [
            "string",
            "null"
          ],
          "description": "Human-readable error details (only present if status=failed)"
        },
        "logLocation": {
          "type": [
            "string",
            "null"
          ],
          "description": "Path to job logs (for debugging)"
        },
        "creditsCharged": {
          "type": [
            "number",
            "null"
          ],
          "description": "Total credits consumed by this job. Omitted for jobs run before credit tracking was introduced."
        },
        "jobSize": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "small",
            "large"
          ],
          "description": "Compute tier used for the job. Omitted for jobs run before credit tracking was introduced."
        }
      }
    }
  },
  "$defs": {
    "JobMetrics": {
      "type": "object",
      "description": "Job execution metrics (present when job is complete)",
      "properties": {
        "recordsRead": {
          "type": "integer",
          "description": "Total records read from all source files"
        },
        "recordsWritten": {
          "type": "integer",
          "description": "Total records written to all target tables"
        },
        "filesProcessed": {
          "type": "integer",
          "description": "Number of input files processed from manifest"
        },
        "transformErrorCount": {
          "type": "integer",
          "description": "Number of transformation errors encountered"
        },
        "dataQualityIssues": {
          "type": "array",
          "description": "List of data quality issues found during transformation",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}