{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/primecutsnursery-com/json-schema/primecutsnursery-com-inventory-schema.json",
  "title": "Inventory",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/primecutsnursery-com-openapi.yml#/components/schemas/Inventory",
  "type": "object",
  "properties": {
    "as_of": {
      "type": "string",
      "format": "date-time"
    },
    "fresh": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InventoryRow"
      },
      "description": "Rooted clones available now"
    },
    "tall": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InventoryRow"
      },
      "description": "Talls / clearance"
    },
    "forecast": {
      "type": "object",
      "properties": {
        "dates": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "iso": {
                "type": "string",
                "format": "date"
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "iso",
              "label"
            ]
          }
        },
        "strains": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "strain": {
                "type": "string"
              },
              "menu_slug": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sold_out": {
                "type": "boolean",
                "description": "True when every forecast batch is already reserved"
              },
              "by_date": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string",
                      "format": "date"
                    },
                    "label": {
                      "type": "string",
                      "description": "M/D as shown on /live-inventory"
                    },
                    "quantity": {
                      "type": "integer",
                      "description": "Units finishing on that date (not cumulative)"
                    }
                  },
                  "required": [
                    "date",
                    "label",
                    "quantity"
                  ]
                },
                "description": "Only dates with units; ordered by date"
              }
            },
            "required": [
              "strain",
              "menu_slug",
              "sold_out",
              "by_date"
            ]
          }
        }
      },
      "required": [
        "dates",
        "strains"
      ],
      "description": "17-day rooting forecast"
    },
    "fresh_on_date": {
      "type": "object",
      "properties": {
        "dates": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "date"
          },
          "description": "Today, then each forecast date"
        },
        "strains": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "strain": {
                "type": "string"
              },
              "menu_slug": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "by_date": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string",
                      "format": "date"
                    },
                    "quantity": {
                      "type": "integer",
                      "description": "Fresh clones sellable on that date: finished rooting by then and not yet aged into talls"
                    }
                  },
                  "required": [
                    "date",
                    "quantity"
                  ]
                },
                "description": "Dates missing from this list have none"
              }
            },
            "required": [
              "strain",
              "menu_slug",
              "by_date"
            ]
          }
        }
      },
      "required": [
        "dates",
        "strains"
      ],
      "description": "Fresh clones available ON each date. Today's fresh that turns tall later is not counted after that; talls are never projected forward"
    },
    "ordering": {
      "type": "object",
      "description": "Clone ordering terms",
      "additionalProperties": true
    },
    "html_url": {
      "type": "string",
      "description": "Canonical HTML page for this resource",
      "format": "uri"
    },
    "teens": {
      "oneOf": [
        {
          "$ref": "#/$defs/TeenSummary"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "as_of",
    "fresh",
    "tall",
    "forecast",
    "html_url",
    "teens"
  ],
  "$defs": {
    "InventoryRow": {
      "type": "object",
      "properties": {
        "strain": {
          "type": "string",
          "description": "Display name as tracked in the nursery"
        },
        "menu_slug": {
          "oneOf": [
            {
              "type": "string",
              "description": "Menu-page slug when this strain is on the public menu"
            },
            {
              "type": "null"
            }
          ]
        },
        "quantity": {
          "type": "integer",
          "description": "Units available (fresh: rooted clones; tall: overgrown clearance)"
        },
        "sold_out": {
          "type": "boolean"
        }
      },
      "required": [
        "strain",
        "menu_slug",
        "quantity",
        "sold_out"
      ]
    },
    "TeenItem": {
      "type": "object",
      "properties": {
        "strain": {
          "type": "string"
        },
        "pot": {
          "type": "string",
          "description": "Pot size as shown on /teen-inventory"
        },
        "quantity": {
          "type": "integer"
        }
      },
      "required": [
        "strain",
        "pot",
        "quantity"
      ]
    },
    "TeenSummary": {
      "type": "object",
      "properties": {
        "ready_now": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TeenItem"
          },
          "description": "Teens ready now"
        },
        "upcoming": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "ready_date": {
                "type": "string",
                "format": "date"
              },
              "label": {
                "type": "string"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/TeenItem"
                }
              }
            },
            "required": [
              "ready_date",
              "label",
              "items"
            ]
          },
          "description": "Teens by ready date"
        },
        "totals": {
          "type": "object",
          "properties": {
            "ready_now": {
              "type": "integer"
            },
            "upcoming": {
              "type": "integer"
            }
          },
          "required": [
            "ready_now",
            "upcoming"
          ]
        },
        "as_of": {
          "type": "string",
          "format": "date-time"
        },
        "url": {
          "type": "string",
          "description": "Canonical HTML page for this resource",
          "format": "uri"
        }
      },
      "required": [
        "ready_now",
        "upcoming",
        "totals",
        "as_of",
        "url"
      ],
      "description": "Ready-to-flip teens exactly as listed on /teen-inventory (separate product line and pricing from clones)"
    }
  }
}