{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/swell-io/main/json-schema/swell-product-schema.json",
  "title": "Swell Product",
  "type": "object",
  "required": ["name", "sku"],
  "properties": {
    "id": { "type": "string", "description": "MongoDB-style object ID.", "pattern": "^[a-f0-9]{24}$" },
    "name": { "type": "string", "description": "Human-friendly product name." },
    "slug": { "type": "string", "description": "URL-friendly identifier, auto-generated from name." },
    "sku": { "type": "string", "description": "Stock keeping unit." },
    "active": { "type": "boolean" },
    "type": { "type": "string", "enum": ["standard", "subscription", "bundle", "giftcard"] },
    "delivery": { "type": ["string", "null"], "enum": ["shipment", "subscription", "giftcard", null] },
    "price": { "type": "number" },
    "sale": { "type": "boolean" },
    "sale_price": { "type": "number" },
    "currency": { "type": "string", "minLength": 3, "maxLength": 3 },
    "description": { "type": "string" },
    "stock_tracking": { "type": "boolean" },
    "stock_level": { "type": "integer" },
    "stock_status": { "type": "string", "enum": ["in_stock", "out_of_stock", "preorder", "backorder"] },
    "stock_purchasable": { "type": "boolean" },
    "variable": { "type": "boolean" },
    "variants": { "type": "array", "items": { "type": "object" } },
    "options": { "type": "array", "items": { "type": "object" } },
    "bundle": { "type": "boolean" },
    "bundle_items": { "type": "array", "items": { "type": "object" } },
    "purchase_options": { "type": "object" },
    "category_id": { "type": "string" },
    "categories": { "type": "array", "items": { "type": "object" } },
    "shipment_weight": { "type": "number" },
    "shipment_dimensions": { "type": "object" },
    "images": { "type": "array", "items": { "type": "object" } },
    "tags": { "type": "array", "items": { "type": "string" } },
    "meta_title": { "type": "string" },
    "meta_keywords": { "type": "string" },
    "meta_description": { "type": "string" },
    "date_created": { "type": "string", "format": "date-time" },
    "date_updated": { "type": "string", "format": "date-time" }
  }
}
