{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lemmebuyit-com/json-schema/lemmebuyit-com-product-schema.json",
  "title": "Product",
  "description": "Represents a product listing from a specific retailer.",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lemmebuyit-com-openapi.yaml#/components/schemas/Product",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "format": "int64",
      "description": "Unique identifier for the product within the retailer's catalog."
    },
    "retailer_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Retailer identifier for the product record."
    },
    "unique_merchant_sku": {
      "type": "string",
      "description": "Retailer's specific Stock Keeping Unit (SKU)."
    },
    "product_name": {
      "type": "string",
      "description": "The name or title of the product."
    },
    "product_description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Detailed description of the product."
    },
    "product_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "url",
      "description": "Direct URL to the product page on the retailer's website."
    },
    "image_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "url",
      "description": "URL of the primary product image. (Deprecated: use primary_image_url)"
    },
    "primary_image_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "URL of the main product image."
    },
    "additional_images": {
      "type": [
        "array",
        "null"
      ],
      "description": "Array of additional product image URLs.",
      "items": {
        "type": "string"
      }
    },
    "current_price": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "The current selling price."
    },
    "original_price": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "The original price before discounts (MSRP)."
    },
    "currency": {
      "type": [
        "string",
        "null"
      ],
      "description": "Currency code (ISO 4217)."
    },
    "discount_percentage": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "Calculated discount percentage from original to current price."
    },
    "category": {
      "type": [
        "string",
        "null"
      ],
      "description": "Product category path or name."
    },
    "category_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Retailer's specific category ID."
    },
    "brand": {
      "type": [
        "string",
        "null"
      ],
      "description": "The product brand name."
    },
    "manufacturer": {
      "type": [
        "string",
        "null"
      ],
      "description": "The product manufacturer."
    },
    "sold_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "The seller or vendor name for the product (e.g., \"Walmart.com\", \"CREAT3D\"). Indicates whether the product is sold by the retailer directly or by a third-party marketplace seller."
    },
    "is_clearance": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "True when the item is currently flagged as clearance by the hourly clearance-watch pipeline (Walmart)."
    },
    "deal_type": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "clearance",
        "rollback",
        "reduced"
      ],
      "description": "Walmart deal type from the clearance-watch pipeline."
    },
    "clearance_discount_pct": {
      "type": [
        "number",
        "null"
      ],
      "format": "float",
      "description": "Percent off the was-price observed by the clearance-watch pipeline at clearance_seen_at."
    },
    "clearance_seen_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "UTC timestamp when the deal/clearance status was last observed (hourly sweep)."
    },
    "stock_availability": {
      "type": [
        "string",
        "null"
      ],
      "description": "Stock status indicator (e.g., 'In Stock', 'Out of Stock')."
    },
    "upc": {
      "type": [
        "string",
        "null"
      ],
      "description": "Universal Product Code."
    },
    "ean": {
      "type": [
        "string",
        "null"
      ],
      "description": "European Article Number."
    },
    "mpn": {
      "type": [
        "string",
        "null"
      ],
      "description": "Manufacturer Part Number."
    },
    "asins": {
      "type": "array",
      "description": "Amazon ASIN mappings associated with the retailer product.",
      "items": {
        "type": "string"
      }
    },
    "amazon_affiliate_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "url",
      "description": "Amazon Associates tagged buy link for the primary (first) ASIN."
    },
    "amazon_affiliate_urls": {
      "type": "array",
      "description": "Amazon Associates tagged buy links, one per ASIN (aligned with `asins`).",
      "items": {
        "type": "string",
        "format": "url"
      }
    },
    "subcategory": {
      "type": [
        "string",
        "null"
      ],
      "description": "Product subcategory."
    },
    "in_stock": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Boolean indicating if the product is currently in stock."
    },
    "order_limit": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Per-order purchase cap (Walmart `orderLimit`), sourced from browser extension sightings. Doubles as a low-stock depth proxy: clamped toward the true remaining units once stock falls below the normal cap.\n"
    },
    "units_left": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Badge-confirmed true remaining-units count (Walmart LOW_INVENTORY \"Only N left\" badge), sourced from browser extension sightings. Only present when stock is genuinely low — the authoritative near-sell-out signal, where `order_limit` is a plain per-order cap.\n"
    },
    "gtin": {
      "type": [
        "string",
        "null"
      ],
      "description": "Global Trade Item Number."
    },
    "model": {
      "type": [
        "string",
        "null"
      ],
      "description": "Product model name or number."
    },
    "condition": {
      "type": [
        "string",
        "null"
      ],
      "description": "Product condition (e.g., New, Used, Refurbished)."
    },
    "color": {
      "type": [
        "string",
        "null"
      ],
      "description": "Product color."
    },
    "size": {
      "type": [
        "string",
        "null"
      ],
      "description": "Product size."
    },
    "material": {
      "type": [
        "string",
        "null"
      ],
      "description": "Product material."
    },
    "weight": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "Product weight (in product's weight unit)."
    },
    "rating": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "Average product rating (0-5 scale)."
    },
    "review_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Number of customer reviews."
    },
    "shipping_cost": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "Shipping cost for the product."
    },
    "amazon_price": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "Latest matched Amazon offer price for the mapped ASIN."
    },
    "amazon_reviews": {
      "allOf": [
        {
          "$ref": "#/$defs/AmazonReviews"
        }
      ],
      "nullable": true
    },
    "amazon_marketplace": {
      "allOf": [
        {
          "$ref": "#/$defs/AmazonMarketplace"
        }
      ],
      "nullable": true
    },
    "profitability": {
      "allOf": [
        {
          "$ref": "#/$defs/Profitability"
        }
      ],
      "nullable": true
    },
    "price_averages": {
      "allOf": [
        {
          "$ref": "#/$defs/PriceAverages"
        }
      ],
      "nullable": true,
      "description": "Pre-computed lifetime / 30 / 90 / 180 / 365-day averages for\nAmazon retail / 3P New / Buy Box / monthly_sold and Walmart\nprice. Populated by the daily price-history sampler — fields\nwithin each window may be null until enough samples accumulate.\n"
    },
    "canonical_identifier": {
      "type": [
        "string",
        "null"
      ],
      "description": "Stable canonical identifier derived from internal identifier mapping."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the record was created in the LemMeBuyIt system."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the record was last updated in the LemMeBuyIt system."
    },
    "indexed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Timestamp when the product was last indexed into the search system."
    }
  },
  "$defs": {
    "AmazonMarketplace": {
      "type": "object",
      "properties": {
        "average30": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "average90": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "average180": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "lowest_price": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "highest_price": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "offer_count": {
          "type": [
            "integer",
            "null"
          ]
        },
        "estimated_sales": {
          "type": [
            "integer",
            "null"
          ]
        },
        "sales_rank": {
          "type": [
            "integer",
            "null"
          ]
        },
        "score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "buy_box_is_amazon": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "sold_by_amazon": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "in_stock": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "last_seen_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "brand": {
          "type": [
            "string",
            "null"
          ]
        },
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "color": {
          "type": [
            "string",
            "null"
          ]
        },
        "size": {
          "type": [
            "string",
            "null"
          ]
        },
        "package_quantity": {
          "type": [
            "integer",
            "null"
          ]
        },
        "title": {
          "type": [
            "string",
            "null"
          ]
        },
        "variation_parent_asin": {
          "type": [
            "string",
            "null"
          ]
        },
        "variation_title": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "AmazonReviews": {
      "type": "object",
      "properties": {
        "count": {
          "type": [
            "integer",
            "null"
          ]
        },
        "stars": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      }
    },
    "MonthlySoldBlock": {
      "type": "object",
      "description": "Estimated-monthly-sold sub-block on `price_averages`. Carries the\ncurrent value, a percent delta against the 90-day rolling average,\nand standard windowed means.\n",
      "properties": {
        "current": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Most recent monthly-sold value at the time of sampling."
        },
        "change_vs_90d_avg_pct": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "((current - last_90_days_avg) / last_90_days_avg) * 100.\nPositive values indicate accelerating sales; negative values a slowdown.\nNull when the 90-day average is unknown or zero.\n"
        },
        "lifetime": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "last_30_days": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "last_90_days": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "last_180_days": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "last_365_days": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "as_of": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        }
      }
    },
    "PriceAverages": {
      "type": "object",
      "description": "Pre-computed history averages produced by the price-history\nsampler, attached to the underlying mapping/products doc. Each\nsub-block carries lifetime + last-30/90/180/365-day windowed\nmeans. Fields are null when the underlying retailer doesn't\ncarry that metric (e.g., a Walmart-only doc will have\n`walmart_price` populated and all `amz_*` fields null). The\n`PriceWindow` schema is reused as a generic numeric window;\nnot all fields are prices.\n",
      "properties": {
        "amz_retail": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Amazon-as-seller new lowest price averages (USD)."
        },
        "amz_3p_new": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Third-party merchant-fulfilled new lowest price averages (USD)."
        },
        "amz_buy_box": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Buy Box winner landed-price averages (USD)."
        },
        "amz_list_price": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Manufacturer suggested list-price averages (USD)."
        },
        "sales_rank": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Amazon best-sellers rank (BSR) averages. Lower is better.\nValues are integer in source samples; averages may be fractional.\n"
        },
        "offer_count_new": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Average number of New-condition offers observed per sample."
        },
        "offer_count_used": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Average number of Used-condition offers observed per sample."
        },
        "rating": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Average customer rating (0–5 stars) over the windowed observations."
        },
        "review_count": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Average customer review count observed per sample. Note that\nreview_count is monotonically nondecreasing, so the lifetime\nmean trails the most-recent observation.\n"
        },
        "monthly_sold": {
          "allOf": [
            {
              "$ref": "#/$defs/MonthlySoldBlock"
            }
          ],
          "nullable": true
        },
        "walmart_price": {
          "allOf": [
            {
              "$ref": "#/$defs/PriceWindow"
            }
          ],
          "nullable": true,
          "description": "Walmart current-price averages (USD)."
        }
      }
    },
    "PriceWindow": {
      "type": "object",
      "description": "Lifetime + last-N-day averages for a single price metric, sampled\ndaily by the price-history pipeline. Each window is the arithmetic\nmean of weekly samples that fall within the window relative to `as_of`.\nFields are null when no samples cover the window (e.g., on day 1 the\n365-day field is unpopulated for a freshly-seen ASIN).\n",
      "properties": {
        "lifetime": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "last_30_days": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "last_90_days": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "last_180_days": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "last_365_days": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "as_of": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Date of the most recent sample contributing to these averages."
        }
      }
    },
    "Profitability": {
      "type": "object",
      "properties": {
        "status": {
          "type": [
            "string",
            "null"
          ]
        },
        "amazon_price": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "retailer_cost": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "profit_per_unit": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "margin": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "roi": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "adjustments": {
          "allOf": [
            {
              "$ref": "#/$defs/ProfitabilityAdjustments"
            }
          ],
          "nullable": true
        }
      }
    },
    "ProfitabilityAdjustments": {
      "type": "object",
      "properties": {
        "shipping_cost": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "fixed_additional_cost": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "percent_additional_cost": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      }
    }
  }
}