{
 "use_case": "filing-preflight",
 "title": "Filing pre-flight: a fictional brief with planted errors, as a Word file, and its appendix as a PDF",
 "about": "A short fictional appellate brief (Doe v. Harbor Point Unified School District) as a .docx and its six-page appendix as a PDF, both sent as raw files the way a firm would upload them. The brief has planted problems: a record cite the appendix contradicts (App. 4), a cite to a page not in the appendix (App. 9), a synthetic SSN, birth date, account number and a minor's full name, an invented case and a misquote. The check must find the planted record-cite and privacy problems and end in a signed record that verifies. Case lookups go to the free public sources (Caselaw Access Project, CourtListener, LII, uscode.house.gov); the brief's text is never sent to them.",
 "licence": "Fictional: the brief, the appendix, the parties and every identifier were written for Decosa (no real case or people); the Supreme Court cases it cites are public domain. Part of decosa-api, AGPL-3.0-or-later.",
 "inputs": [
  {
   "file": "inputs/brief-doe-v-harbor-point.docx",
   "what": "The brief as a Word file (a PDF or plain text works too): the argument with its case, statute and record cites. Up to about 25 pages of argument."
  },
  {
   "file": "inputs/appendix-app-1-6.pdf",
   "what": "The record excerpt the brief cites as \"App.\", one PDF page per appendix page with an \"App. N\" footer (or page-marker lines like [[4]] in a text file)."
  }
 ],
 "steps": [
  {
   "id": "parse_brief",
   "method": "POST",
   "path": "/preflight/parse?name=brief-doe-v-harbor-point.docx",
   "raw_file": "inputs/brief-doe-v-harbor-point.docx",
   "content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
  },
  {
   "id": "parse_appendix",
   "method": "POST",
   "path": "/preflight/parse?name=appendix-app-1-6.pdf",
   "raw_file": "inputs/appendix-app-1-6.pdf",
   "content_type": "application/pdf"
  },
  {
   "id": "check",
   "method": "POST",
   "path": "/preflight/check",
   "timeout": 300,
   "body": {
    "upload_id": {
     "$ref": "parse_brief.upload_id"
    },
    "record": [
     {
      "label": "App.",
      "upload_id": {
       "$ref": "parse_appendix.upload_id"
      }
     }
    ],
    "title": "Rehearsal: Doe v. Harbor Point USD (fictional)",
    "stream": false
   }
  },
  {
   "id": "export",
   "method": "GET",
   "path": "/preflight/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.statement.decision",
    "set": "ok"
   }
  }
 ],
 "checks": [
  {
   "says": "the Word file is read as a brief",
   "path": "parse_brief.kind",
   "equals": "docx"
  },
  {
   "says": "the appendix PDF is read and its redaction check runs",
   "path": "parse_appendix.redaction.ran",
   "equals": true
  },
  {
   "says": "the pre-flight decision is: problems",
   "path": "check.decision",
   "equals": "problems"
  },
  {
   "says": "the invented case (Varghese v. China Southern Airlines, from Mata v. Avianca) is a problem",
   "path": "check.items[check=authority,status=problem,title~Varghese]",
   "count_min": 1
  },
  {
   "says": "the one-word misquote of T.L.O. is a problem",
   "path": "check.items[check=quote,status=problem,title~substantial need]",
   "count_min": 1
  },
  {
   "says": "the record cite the appendix contradicts (App. 4) is a problem",
   "path": "check.items[check=record,status=problem,title=App. 4]",
   "count_min": 1
  },
  {
   "says": "the cite to a page not in the appendix (App. 9) is a problem",
   "path": "check.items[check=record,status=problem,title=App. 9]",
   "count_min": 1
  },
  {
   "says": "at least four privacy items (SSN, birth date, account number, minor's name) are problems",
   "path": "check.items[check=privacy,status=problem]",
   "count_min": 4
  },
  {
   "says": "the partner-review Markdown lists the invented case as a problem",
   "path": "export",
   "contains": [
    "PROBLEM",
    "Varghese"
   ]
  },
  {
   "says": "the signed record verifies",
   "path": "verify.ok",
   "equals": true
  },
  {
   "says": "a record with its decision changed to ok no longer verifies",
   "path": "tampered.ok",
   "equals": false
  },
  {
   "says": "every model call has a signed receipt",
   "receipts": "signed"
  }
 ]
}
