{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/compsniper-com/json-schema/compsniper-com-card-batch-job-schema.json",
  "title": "CardBatchJob",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/compsniper-com-openapi.json#/components/schemas/CardBatchJob",
  "type": "object",
  "properties": {
    "jobId": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "done",
        "partial",
        "cancelled",
        "failed"
      ]
    },
    "totalCards": {
      "type": "integer"
    },
    "processedCards": {
      "type": "integer"
    },
    "remainingCards": {
      "type": "integer"
    },
    "succeededCards": {
      "type": "integer"
    },
    "failedCards": {
      "type": "integer"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CardBatchResult"
      }
    },
    "upgradeUrl": {
      "type": "string",
      "format": "uri",
      "description": "Present when processing stopped because the account quota was exhausted."
    }
  },
  "$defs": {
    "CardBatchResult": {
      "type": "object",
      "required": [
        "keyword",
        "ok"
      ],
      "properties": {
        "reference": {
          "type": "string"
        },
        "card": {
          "$ref": "#/$defs/CardInput"
        },
        "keyword": {
          "type": "string"
        },
        "ok": {
          "type": "boolean"
        },
        "totalResults": {
          "type": [
            "string",
            "null"
          ]
        },
        "totalItems": {
          "type": "integer"
        },
        "rawMedian": {
          "type": [
            "number",
            "null"
          ]
        },
        "rawSampleCount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "summary": {
          "$ref": "#/$defs/PriceSummary"
        },
        "cached": {
          "type": "boolean"
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CompactSoldItem"
          }
        },
        "error": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    },
    "CardInput": {
      "type": "object",
      "description": "Supply an exact keyword, or structured fields. subject is universal; player and character are convenient aliases.",
      "properties": {
        "reference": {
          "type": "string",
          "description": "Your inventory or correlation ID, echoed in the result."
        },
        "keyword": {
          "type": "string",
          "maxLength": 300,
          "description": "Exact eBay search keyword. When present it overrides generated structured-field keywords."
        },
        "subject": {
          "type": "string"
        },
        "player": {
          "type": "string"
        },
        "character": {
          "type": "string"
        },
        "year": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            }
          ]
        },
        "set": {
          "type": "string"
        },
        "cardNumber": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            }
          ]
        },
        "parallel": {
          "type": "string"
        },
        "grader": {
          "type": "string"
        },
        "grade": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            }
          ]
        }
      }
    },
    "CompactSoldItem": {
      "type": "object",
      "properties": {
        "itemId": {
          "type": "string"
        },
        "title": {
          "type": [
            "string",
            "null"
          ]
        },
        "soldPrice": {
          "type": [
            "string",
            "null"
          ]
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        },
        "shippingPrice": {
          "type": [
            "string",
            "null"
          ]
        },
        "totalPrice": {
          "type": [
            "string",
            "null"
          ]
        },
        "condition": {
          "type": [
            "string",
            "null"
          ]
        },
        "bestOfferAccepted": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "true when eBay marked an accepted Best Offer; null otherwise. The accepted amount is not disclosed."
        },
        "soldDate": {
          "type": [
            "string",
            "null"
          ]
        },
        "sellerUsername": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "PriceSummary": {
      "type": [
        "object",
        "null"
      ],
      "description": "Deterministic price intelligence over the returned sold items.",
      "properties": {
        "count": {
          "type": "integer",
          "description": "Items with a usable sold price."
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        },
        "median": {
          "type": "number"
        },
        "mean": {
          "type": "number"
        },
        "min": {
          "type": "number"
        },
        "max": {
          "type": "number"
        },
        "p25": {
          "type": "number",
          "description": "Lower bound of the realistic range."
        },
        "p75": {
          "type": "number",
          "description": "Upper bound of the realistic range."
        },
        "avgShipping": {
          "type": [
            "number",
            "null"
          ]
        }
      }
    }
  }
}