{
 "use_case": "promo-claims-check",
 "title": "Promotional claims pre-check: a supplement page against its fact sheet",
 "about": "A product page for a fictional magnesium supplement, checked against the public NIH fact sheet and a synthetic spec. It makes three disease claims (insomnia, blood pressure, migraines) and has no DSHEA disclaimer, so the pre-check must flag them, and the signed MLR packet must verify and catch a changed status.",
 "licence": "Synthetic promotional copy for the fictional brand Fernhill, written for Decosa. Reference: NIH Office of Dietary Supplements magnesium fact sheet (US government work, public domain) plus a synthetic product spec. Part of decosa-api, AGPL-3.0-or-later.",
 "inputs": [
  {
   "file": "inputs/piece.md",
   "what": "The promotional piece to check, as plain text or Markdown (your page, brochure or email copy)."
  },
  {
   "file": "inputs/product.json",
   "what": "The product: {type: drug | supplement | device, name, indication?}."
  },
  {
   "file": "inputs/references.json",
   "what": "The references claims may rest on: a list of {title, kind (label, study, other), text}."
  }
 ],
 "steps": [
  {
   "id": "check",
   "method": "POST",
   "path": "/promo/check",
   "body": {
    "piece": {
     "text": {
      "$file": "inputs/piece.md"
     },
     "title": "Rehearsal: Fernhill Calm product page (fictional)"
    },
    "product": {
     "$file": "inputs/product.json"
    },
    "references": {
     "$file": "inputs/references.json"
    },
    "claims_matrix": []
   }
  },
  {
   "id": "verify",
   "method": "POST",
   "path": "/promo/verify",
   "auth": false,
   "body": {
    "packet": {
     "$ref": "check.packet"
    },
    "packet_md": {
     "$ref": "check.packet_md"
    },
    "text": {
     "$file": "inputs/piece.md"
    },
    "references": {
     "$file": "inputs/references.json"
    }
   }
  },
  {
   "id": "tampered",
   "method": "POST",
   "path": "/promo/verify",
   "auth": false,
   "body": {
    "packet": {
     "$ref": "check.packet"
    }
   },
   "tamper": {
    "at": "packet.status",
    "set": "clear"
   }
  }
 ],
 "checks": [
  {
   "says": "the piece comes back with issues",
   "path": "check.status",
   "equals": "issues"
  },
  {
   "says": "at least two disease claims are flagged",
   "path": "check.counts.disease_claim",
   "min": 2
  },
  {
   "says": "the planted 'cure insomnia' sentence is flagged as a disease claim",
   "path": "check.claims[i=3][0].findings",
   "any_equals": "disease_claim"
  },
  {
   "says": "the missing DSHEA disclaimer is flagged",
   "path": "check.counts.dshea_disclaimer_missing",
   "min": 1
  },
  {
   "says": "the signed packet verifies",
   "path": "verify.valid_signature",
   "equals": true
  },
  {
   "says": "the packet matches the MLR Markdown packet",
   "path": "verify.packet_md_matches",
   "equals": true
  },
  {
   "says": "the packet matches the piece",
   "path": "verify.piece_matches",
   "equals": true
  },
  {
   "says": "the packet matches the references",
   "path": "verify.references_match",
   "equals": true
  },
  {
   "says": "a packet with its status changed to clear no longer verifies",
   "path": "tampered.valid_signature",
   "equals": false
  },
  {
   "says": "every model call has a signed receipt",
   "receipts": "signed",
   "min": 4
  }
 ]
}
