{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/salesforce-commerce-cloud/json-schema/salesforce-commerce-cloud-availability-result-schema.json",
  "title": "AvailabilityResult",
  "description": "Result document containing an array of product availability.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/salesforce-commerce-cloud-shopper-availability-api-openapi.yml#/components/schemas/AvailabilityResult",
  "type": "object",
  "required": [
    "limit",
    "data",
    "total"
  ],
  "properties": {
    "limit": {
      "format": "int32",
      "description": "The number of returned product entries in the data array.",
      "type": "integer"
    },
    "data": {
      "description": "The array of product availability entries. Each entry represents one product (SKU) with available inventory across the requested inventory lists.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/Availability"
      }
    },
    "total": {
      "format": "int32",
      "description": "The total number of distinct product entries in the data array, not individual inventory records.",
      "type": "integer"
    }
  },
  "$defs": {
    "Availability": {
      "description": "Availability of one product across the requested inventory lists, or the site-assigned default inventory list.",
      "type": "object",
      "required": [
        "id",
        "inventories"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/ProductId"
        },
        "inventories": {
          "description": "The array of inventory information for the product.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Inventory"
          }
        }
      }
    },
    "Inventory": {
      "description": "Document representing inventory information of the current product for a particular inventory list.",
      "properties": {
        "ats": {
          "format": "double",
          "description": "The Available To Sell (ATS) of the product. If it is infinity, the return value is 999999. The value can be overwritten by the\n OCAPI setting 'product.inventory.ats.max_threshold'.",
          "type": "number"
        },
        "backorderable": {
          "description": "A flag indicating whether the product is backorderable.",
          "type": "boolean"
        },
        "id": {
          "$ref": "#/$defs/InventoryId"
        },
        "inStockDate": {
          "description": "A flag indicating the date when the product will be in stock.",
          "type": "string",
          "format": "date-time"
        },
        "orderable": {
          "description": "A flag indicating whether at least one of the products is available to sell.",
          "type": "boolean"
        },
        "preorderable": {
          "description": "A flag indicating whether the product is preorderable.",
          "type": "boolean"
        },
        "stockLevel": {
          "format": "double",
          "description": "The stock level of the product. If it is infinity, the return value is 999999. The value can be overwritten by the\n OCAPI setting 'product.inventory.stock_level.max_threshold'.",
          "type": "number"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "InventoryId": {
      "description": "The inventory ID.",
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "ProductId": {
      "minLength": 1,
      "maxLength": 100,
      "type": "string",
      "description": "The id (SKU) of the product."
    }
  }
}