{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/certifyos/main/json-schema/certifyos-directory-job-status-response-schema.json",
  "title": "DirectoryJobStatusResponse",
  "description": "Response containing directory job status information",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/certifyos-directory-api-openapi.yml#/components/schemas/DirectoryJobStatusResponse",
  "type": "object",
  "properties": {
    "exportJobId": {
      "type": "string",
      "description": "Unique identifier for the directory job"
    },
    "tenantId": {
      "type": "string",
      "description": "ID of the tenant"
    },
    "entityType": {
      "type": "string",
      "description": "Entity type (practitioners, facilities, or groups)"
    },
    "status": {
      "$ref": "#/$defs/JobStatus",
      "type": "string",
      "description": "Current status of the job: IN_QUEUE, MAPPING, IN_PROGRESS, SEED_COMPLETED, TEMPLATE_EXPORT_IN_PROGRESS, COMPLETED, or FAILED. Serialized as the enum constant name."
    },
    "stats": {
      "$ref": "#/$defs/JobStats",
      "type": "object",
      "description": "Job processing statistics"
    },
    "fileUrl": {
      "type": "string",
      "description": "Download URL for the exported file, present only once status is COMPLETED. Normally a time-limited signed GCS URL (valid 8 hours); falls back to the raw, unsigned gs:// URI if signing fails."
    }
  },
  "$defs": {
    "JobStats": {
      "type": "object",
      "description": "Statistics for directory job processing",
      "properties": {
        "completed": {
          "type": "integer",
          "format": "int64",
          "description": "Number of rows with data processed so far"
        },
        "total": {
          "type": "integer",
          "format": "int64",
          "description": "Total number of rows to process"
        },
        "failed": {
          "type": "integer",
          "format": "int64",
          "description": "Number of failed rows. Not currently populated by the egress service integration; always 0."
        }
      }
    },
    "JobStatus": {
      "type": "string",
      "enum": [
        "IN_QUEUE",
        "MAPPING",
        "IN_PROGRESS",
        "SEED_COMPLETED",
        "TEMPLATE_EXPORT_IN_PROGRESS",
        "COMPLETED",
        "FAILED"
      ]
    }
  }
}