{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://proteinbenchmark.com/.well-known/products-schema.json",
  "title": "ProteinBenchmark Product",
  "description": "A single scored product in the ProteinBenchmark dataset, as returned by /api/v1/products. Computed metrics (density, tier, day, pce) ship in the document so agents need not reimplement the math. Category-specific fields (e.g. protein_type, chain, cuisine) appear in addition to the common fields below.",
  "type": "object",
  "required": [
    "id",
    "slug",
    "category",
    "name",
    "calories",
    "protein_g",
    "density",
    "tier",
    "last_synced_at",
    "source_commit_sha"
  ],
  "additionalProperties": true,
  "properties": {
    "id": { "type": "string", "description": "Category-namespaced unique id (e.g. powder-dymatize-iso100-hydrolyzed). Use with GET /api/v1/products/{id}." },
    "slug": { "type": "string", "description": "Original per-collection slug (not globally unique)." },
    "category": { "type": "string", "enum": ["snack", "powder", "restaurant", "food", "dish"] },
    "name": { "type": "string" },
    "brand": { "type": "string", "description": "Brand / chain / manufacturer where applicable." },
    "serving_size_g": { "type": ["number", "null"] },
    "serving_desc": { "type": ["string", "null"], "description": "Human serving description when a gram weight is not defined (restaurant items, dishes)." },
    "calories": { "type": "number", "minimum": 0 },
    "protein_g": { "type": "number", "minimum": 0 },
    "protein_source": {
      "type": ["string", "null"],
      "enum": ["whey", "dairy", "egg", "meat", "soy", "pea", "mixed", "grain", "collagen", null]
    },
    "leucine_g": { "type": ["number", "null"] },
    "sweetener_type": {
      "type": ["string", "null"],
      "enum": ["none", "stevia", "monk-fruit", "sucralose", "aspartame", "acesulfame-k", "sugar-alcohol", "sugar", "mixed-natural", "mixed-artificial", null]
    },
    "sugar_alcohols": {
      "type": "array",
      "items": { "type": "string", "enum": ["erythritol", "xylitol", "maltitol", "sorbitol", "allulose"] }
    },
    "third_party_certs": {
      "type": "array",
      "items": { "type": "string", "enum": ["nsf-certified-for-sport", "nsf-content-certified", "informed-choice", "informed-sport", "usp-verified", "clean-label-project-purity", "gmp"] }
    },
    "heavy_metal_tested": {
      "type": ["boolean", "null"],
      "description": "true only when the brand publishes third-party heavy-metal lab results or holds a purity certification — not for bare marketing claims."
    },
    "density": { "type": "number", "description": "Protein Density: % of calories from protein = protein_g * 4 / calories * 100." },
    "tier": { "type": "string", "enum": ["platinum", "gold", "silver", "avoid", "unknown"] },
    "g_per_100kcal": { "type": "number" },
    "pce": { "type": ["number", "null"], "description": "Protein Cost-Efficiency (g protein per $). Null until a price is supplied (prices are user-input, not stored)." },
    "day": { "type": ["number", "null"], "description": "Bioavailability-Adjusted Yield: min(protein_g, protein_g * DIAAS_source). Null when protein_source is unknown." },
    "leucine_estimate_g": { "type": ["number", "null"] },
    "meets_leucine_threshold": { "type": ["boolean", "null"], "description": "Whether leucine_estimate_g >= 2.5 g (the MPS trigger)." },
    "last_synced_at": { "type": "string", "format": "date-time" },
    "source_commit_sha": { "type": "string", "description": "git commit the document was synced from (audit trail)." },
    "source_collection": { "type": "string" }
  }
}
