{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tenet-industries/json-schema/tenet-industries-stock-schema.json",
  "title": "Stock",
  "description": "Available stock with full category counts and manufacturer choices.",
  "x-generated": "2026-12-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tenet-industries-openapi.yml#/components/schemas/Stock",
  "properties": {
    "total_count": {
      "default": 0,
      "title": "Total Count",
      "type": "integer"
    },
    "offset": {
      "title": "Offset",
      "type": "integer"
    },
    "limit": {
      "title": "Limit",
      "type": "integer"
    },
    "parts": {
      "items": {
        "$ref": "#/$defs/StockPart"
      },
      "title": "Parts",
      "type": "array"
    },
    "categories": {
      "items": {
        "$ref": "#/$defs/Category"
      },
      "title": "Categories",
      "type": "array"
    },
    "manufacturers": {
      "items": {
        "type": "string"
      },
      "title": "Manufacturers",
      "type": "array"
    },
    "next_offset": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "The following page when more matches exist.",
      "readOnly": true,
      "title": "Next Offset"
    },
    "previous_offset": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "The preceding page, including recovery from an empty page.",
      "readOnly": true,
      "title": "Previous Offset"
    },
    "page_number": {
      "description": "The one-based page number at this offset.",
      "readOnly": true,
      "title": "Page Number",
      "type": "integer"
    }
  },
  "required": [
    "offset",
    "limit",
    "next_offset",
    "previous_offset",
    "page_number"
  ],
  "type": "object",
  "$defs": {
    "Category": {
      "description": "Whole-stock totals and search matches, independent of the selected category and page.",
      "properties": {
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name"
        },
        "pieces": {
          "title": "Pieces",
          "type": "number"
        },
        "total_count": {
          "title": "Total Count",
          "type": "integer"
        },
        "matching_count": {
          "title": "Matching Count",
          "type": "integer"
        }
      },
      "required": [
        "name",
        "pieces",
        "total_count",
        "matching_count"
      ],
      "title": "Category",
      "type": "object"
    },
    "StockPart": {
      "description": "A part's available pieces, excluding every reserved piece.",
      "properties": {
        "part": {
          "title": "Part",
          "type": "string"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "manufacturer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Manufacturer"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Description"
        },
        "category": {
          "title": "Category",
          "type": "string"
        },
        "package": {
          "title": "Package",
          "type": "string"
        },
        "pieces": {
          "title": "Pieces",
          "type": "number"
        },
        "parameters": {
          "additionalProperties": {
            "type": "string"
          },
          "title": "Parameters",
          "type": "object"
        }
      },
      "required": [
        "part",
        "name",
        "manufacturer",
        "description",
        "category",
        "package",
        "pieces",
        "parameters"
      ],
      "title": "StockPart",
      "type": "object"
    }
  }
}