{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/shelfatlas-com/json-schema/shelfatlas-com-term-history-week-schema.json",
  "title": "TermHistoryWeek",
  "description": "One ISO week (Monday, Europe/Copenhagen) in the /offers/term-history window. A week with no matching offer still appears, with offer_count/campaign_count/chain_count 0 and every other field null.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/shelfatlas-com-openapi.json#/components/schemas/TermHistoryWeek",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "week_start",
    "min_price",
    "min_unit_price",
    "unit_price_unit",
    "offer_count",
    "campaign_count",
    "chain_count",
    "cheapest_chain_slug",
    "cheapest_chain_name",
    "cheapest_unit_price",
    "cheapest_unit_price_chain_slug",
    "cheapest_unit_price_chain_name"
  ],
  "properties": {
    "week_start": {
      "type": "string",
      "format": "date",
      "description": "The week's Monday, Europe/Copenhagen calendar."
    },
    "min_price": {
      "type": [
        "number",
        "null"
      ],
      "description": "Lowest shelf price (DKK) across both price_kinds that week — across pack sizes (a 33 cl can and a 1.5 l bottle compete), so not a like-for-like \"cheapest\"; use cheapest_unit_price for that."
    },
    "min_unit_price": {
      "type": [
        "number",
        "null"
      ],
      "description": "The cheapest offer's unit price (DKK), same row as min_price."
    },
    "unit_price_unit": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "l",
        "kg",
        "stk",
        null
      ]
    },
    "offer_count": {
      "type": "integer",
      "description": "Distinct matching offers that week, both price kinds."
    },
    "campaign_count": {
      "type": "integer",
      "description": "Of offer_count, how many were price_kind campaign."
    },
    "chain_count": {
      "type": "integer",
      "description": "Distinct chains carrying a matching offer that week."
    },
    "cheapest_chain_slug": {
      "type": [
        "string",
        "null"
      ],
      "description": "The min_price offer's chain."
    },
    "cheapest_chain_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "cheapest_unit_price": {
      "type": [
        "number",
        "null"
      ],
      "description": "SA-0230: the week's cheapest unit price (DKK per summary.unit), comparing only offers in that unit (unit prices under 2 DKK per l/kg are treated as parse errors and skipped). Null when no offer that week carried the unit, or summary.unit is null."
    },
    "cheapest_unit_price_chain_slug": {
      "type": [
        "string",
        "null"
      ],
      "description": "The chain of the cheapest_unit_price offer."
    },
    "cheapest_unit_price_chain_name": {
      "type": [
        "string",
        "null"
      ]
    }
  }
}