{
 "use_case": "sample-clearance",
 "title": "Sample and lyric clearance: a demo track with planted borrowings",
 "about": "A 75 s demo track (a CC BY host with three planted borrowings), its lyrics with a lifted 1909 line, and a declared-samples list. The check must flag the undeclared slowed slice of \"Fork and Spoon\" near 0:30, find the declared \"Dirt Rhodes\" loop as documented, flag the lifted lyric line, list the declared sample that is not in the catalogue, export a Markdown checklist, and end in a signed record that verifies and fails once edited.",
 "licence": "Audio: host \"Hustle\" by Kevin MacLeod (incompetech.com), CC BY 4.0; plants from catalogue tracks (CC BY 4.0) and a synthetic melody (CC0). Lyrics written for this demo; the lifted lines are from songs published in 1909 and 1913 (public domain in the US). Declared list: fictional.",
 "inputs": [
  {
   "file": "inputs/night-walk-planted.opus",
   "what": "The track to check (Ogg Opus here; WAV, FLAC, MP3, OGG, Opus or M4A up to 20 MB)."
  },
  {
   "file": "inputs/lyrics.lrc",
   "what": "The lyrics, one line per line; LRC timestamps like [00:20.00] are kept and used for 'where'."
  },
  {
   "file": "inputs/declared.txt",
   "what": "What the artist declared: one per line, 'Title - Artist | sample | licence document' (the document part is optional)."
  }
 ],
 "steps": [
  {
   "id": "check",
   "method": "POST",
   "path": "/clearance/check",
   "timeout": 240,
   "body": {
    "audio_b64": {
     "$b64": "inputs/night-walk-planted.opus"
    },
    "lyrics": {
     "$file": "inputs/lyrics.lrc"
    },
    "declared": {
     "$file": "inputs/declared.txt"
    },
    "title": "Night walk (demo track with planted samples)",
    "assume_reserved": true,
    "stream": false
   }
  },
  {
   "id": "export",
   "method": "GET",
   "path": "/clearance/runs/${check.run_id}/export?format=md",
   "as": "text"
  },
  {
   "id": "verify",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "check.report.record"
    }
   }
  },
  {
   "id": "tampered",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "check.report.record"
    }
   },
   "tamper": {
    "at": "record.entries[1].kind",
    "set": "edited"
   }
  }
 ],
 "checks": [
  {
   "says": "the undeclared Fork and Spoon slice is flagged",
   "path": "check.report.checklist[ref.title~Fork and Spoon][0].status",
   "equals": "undeclared"
  },
  {
   "says": "the Fork and Spoon slice is placed near 0:30",
   "path": "check.report.checklist[ref.title~Fork and Spoon][0].where[0].start_s",
   "min": 27,
   "max": 33
  },
  {
   "says": "the declared Dirt Rhodes loop is found and documented",
   "path": "check.report.checklist[ref.title~Dirt Rhodes][0].status",
   "equals": "documented"
  },
  {
   "says": "the lifted 1909 lyric line is flagged",
   "path": "check.report.checklist[kind=lyric,ref.title~Silvery Moon]",
   "count_min": 1
  },
  {
   "says": "the re-played synthetic melody is flagged as an interpolation",
   "path": "check.report.checklist[kind=interpolation,ref.title~Synthetic melody 02]",
   "count_min": 1
  },
  {
   "says": "the declared sample that is not in the catalogue is listed",
   "path": "check.report.declared_not_found[title=Night Train Breaks]",
   "count": 1
  },
  {
   "says": "the Markdown export names the flagged sample",
   "path": "export",
   "contains": "Fork and Spoon"
  },
  {
   "says": "the signed record verifies",
   "path": "verify.ok",
   "equals": true
  },
  {
   "says": "a record with one entry edited no longer verifies",
   "path": "tampered.ok",
   "equals": false
  },
  {
   "says": "every model call has a signed receipt",
   "receipts": "signed"
  }
 ]
}
