{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/compsniper-com/json-schema/compsniper-com-max-job-schema.json",
  "title": "MaxJob",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/compsniper-com-openapi.json#/components/schemas/MaxJob",
  "type": "object",
  "required": [
    "jobId",
    "status",
    "keyword",
    "maxPages",
    "pagesDone",
    "itemsFound",
    "createdAt",
    "updatedAt",
    "creditPreference",
    "rolloverBalance",
    "creditBalance"
  ],
  "properties": {
    "jobId": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "done",
        "maxPages_reached",
        "cancelled",
        "failed"
      ]
    },
    "keyword": {
      "type": "string"
    },
    "maxPages": {
      "type": "integer"
    },
    "pagesDone": {
      "type": "integer"
    },
    "itemsFound": {
      "type": "integer"
    },
    "totalResults": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "startedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "progress": {
      "$ref": "#/$defs/MaxProgress"
    },
    "terminationReason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "natural_end",
        "maxPages_reached",
        "quota_exhausted",
        "upstream_unhealthy",
        "cancelled",
        "terminal_error"
      ]
    },
    "creditPreference": {
      "type": "string",
      "enum": [
        "auto",
        "credits"
      ]
    },
    "rolloverBalance": {
      "type": "integer",
      "description": "Temporary carried-over requests remaining."
    },
    "creditBalance": {
      "type": "integer"
    },
    "resultsUrl": {
      "type": "string"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "summary": {
      "$ref": "#/$defs/MaxSummary"
    },
    "delivery": {
      "type": "object",
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "inline",
            "email",
            "download"
          ]
        },
        "status": {
          "type": "string"
        },
        "downloadUrl": {
          "type": "string"
        }
      }
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SoldItem"
      }
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "purchaseCreditsUrl": {
      "type": "string",
      "format": "uri"
    },
    "upgradeUrl": {
      "type": "string",
      "format": "uri"
    }
  },
  "$defs": {
    "MaxFailedPage": {
      "type": "object",
      "required": [
        "page",
        "code",
        "attempts"
      ],
      "properties": {
        "page": {
          "type": "integer",
          "minimum": 1
        },
        "code": {
          "type": "string",
          "enum": [
            "upstream_blocked",
            "engine_error"
          ]
        },
        "attempts": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2
        }
      }
    },
    "MaxProgress": {
      "type": "object",
      "required": [
        "currentPage",
        "pagesAttempted",
        "pagesSucceeded",
        "pagesFailed",
        "failedPages",
        "itemsCollected",
        "consecutiveFailures"
      ],
      "properties": {
        "currentPage": {
          "type": "integer",
          "minimum": 0
        },
        "pagesAttempted": {
          "type": "integer",
          "minimum": 0
        },
        "pagesSucceeded": {
          "type": "integer",
          "minimum": 0
        },
        "pagesFailed": {
          "type": "integer",
          "minimum": 0
        },
        "failedPages": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MaxFailedPage"
          }
        },
        "itemsCollected": {
          "type": "integer",
          "minimum": 0
        },
        "consecutiveFailures": {
          "type": "integer",
          "minimum": 0,
          "maximum": 5
        }
      }
    },
    "MaxSummary": {
      "type": "object",
      "required": [
        "pagesAttempted",
        "pagesSucceeded",
        "pagesFailed",
        "failedPages",
        "totalItems",
        "partial",
        "terminationReason"
      ],
      "properties": {
        "pagesAttempted": {
          "type": "integer",
          "minimum": 0
        },
        "pagesSucceeded": {
          "type": "integer",
          "minimum": 0
        },
        "pagesFailed": {
          "type": "integer",
          "minimum": 0
        },
        "failedPages": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MaxFailedPage"
          }
        },
        "totalItems": {
          "type": "integer",
          "minimum": 0
        },
        "partial": {
          "type": "boolean"
        },
        "terminationReason": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "natural_end",
            "maxPages_reached",
            "quota_exhausted",
            "upstream_unhealthy",
            "cancelled",
            "terminal_error"
          ]
        }
      }
    },
    "SoldItem": {
      "type": "object",
      "properties": {
        "itemId": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "condition": {
          "type": [
            "string",
            "null"
          ]
        },
        "conditionId": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Best-effort mapping of a known localized eBay condition label."
        },
        "sellerType": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "private",
            "business"
          ],
          "description": "Labeled seller classification on EU marketplaces."
        },
        "listingType": {
          "type": "string",
          "enum": [
            "sold"
          ]
        },
        "bestOfferAccepted": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "true when eBay marked an accepted Best Offer; null when no accepted-offer marker was detected. eBay does not disclose the accepted amount."
        },
        "soldPrice": {
          "type": "string",
          "description": "Decimal string."
        },
        "soldCurrency": {
          "type": "string",
          "description": "ISO 4217."
        },
        "shippingPrice": {
          "type": [
            "string",
            "null"
          ]
        },
        "shippingType": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "free",
            "paid",
            "pickup",
            "unknown"
          ]
        },
        "totalPrice": {
          "type": [
            "string",
            "null"
          ]
        },
        "endedAt": {
          "type": "string",
          "description": "YYYY-MM-DD sold date."
        },
        "sellerUsername": {
          "type": [
            "string",
            "null"
          ]
        },
        "sellerFeedbackScore": {
          "type": [
            "integer",
            "null"
          ]
        },
        "productRating": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 5,
          "description": "eBay catalog star rating shown on the result card. This describes the product, not the seller."
        },
        "productReviewCount": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "description": "Number of eBay catalog ratings behind productRating."
        },
        "itemLocation": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}