{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/emporix/main/json-schema/emporix-dynamic-variant-recalculation-response-schema.json",
  "title": "dynamicVariantRecalculationResponse",
  "description": "Response returned when recalculation is triggered. Contains one job per unique root product resolved from the submitted IDs, plus any IDs that were skipped (for example, because a job for that root is already PENDING or PROCESSING).\n",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/emporix-product-service-openapi.yml#/components/schemas/dynamicVariantRecalculationResponse",
  "type": "object",
  "properties": {
    "jobs": {
      "type": "array",
      "description": "List of recalculation jobs created or referenced for each unique root product.",
      "items": {
        "$ref": "#/$defs/dynamicVariantRecalculationJobResponse"
      }
    },
    "skippedProductIds": {
      "type": "array",
      "description": "Product IDs that were not processed because a recalculation job for their root is already active (PENDING or PROCESSING). The existing job ID is available in the `jobs` list.\n",
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "dynamicVariantRecalculationJobResponse": {
      "type": "object",
      "description": "Represents a single dynamic variant recalculation job. One job is created per unique root product. Jobs remain queryable until automatically removed approximately 30 days after reaching a terminal state.\n",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier of the recalculation job."
        },
        "parentRoot": {
          "type": "string",
          "description": "Identifier of the root product whose variant tree is being recalculated."
        },
        "requestedByIds": {
          "type": "array",
          "description": "List of product IDs that were submitted in the recalculation request and resolved to this root.",
          "items": {
            "type": "string"
          }
        },
        "status": {
          "$ref": "#/$defs/dynamicVariantRecalculationJobStatus"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp when the job was created."
        },
        "processingStartedAt": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp when a subscriber picked up the job and started processing. Null while the job is still PENDING."
        },
        "finishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp when the job reached a terminal state (FINISHED, FAILED, or FAILED_PERMANENT)."
        },
        "error": {
          "type": "string",
          "description": "Error message if the job failed. Null for successful jobs."
        },
        "attempts": {
          "type": "integer",
          "description": "Number of processing attempts made for this job. Incremented on each delivery from the pub/sub subscription."
        }
      }
    },
    "dynamicVariantRecalculationJobStatus": {
      "type": "string",
      "description": "Current status of a dynamic variant recalculation job.",
      "enum": [
        "PENDING",
        "PROCESSING",
        "FINISHED",
        "FAILED",
        "FAILED_PERMANENT"
      ]
    }
  }
}