// Healthcare/HIPAA scenario data — Meridian Health Network
// Used across onboarding, dashboard, traces list, trace replay, auditor view.

const SCENARIO = {
  tenant: {
    name: "Meridian Health Network",
    vertical: "Healthcare (HIPAA)",
    shortName: "Meridian",
    org: "MHN-04221",
    user: { name: "Priya Sharma", role: "Director, AI Risk", initials: "PS" },
  },
  apps: [
    { id: "encounter-summary", name: "Encounter Summary Drafter", calls: 8412, color: "#0c3b6e" },
    { id: "discharge-bot", name: "Discharge Plan Assistant", calls: 2104, color: "#1ea66c" },
    { id: "intake-triage", name: "Intake Triage Helper", calls: 1973, color: "#b45309" },
  ],
  sources: [
    { id: "src_aha_hf24", name: "AHA/ACC Heart Failure Guidelines 2024", kind: "PDF", pages: 178, size: "8.4 MB", hash: "0x9c2e6a1f…b4d2", indexed: "2026-09-14", citations: 412, tags: ["guidelines", "cardiology"] },
    { id: "src_fda_metf", name: "FDA Prescribing Information — Metformin HCl", kind: "PDF", pages: 42, size: "1.1 MB", hash: "0x7afe102d…11c8", indexed: "2026-09-12", citations: 287, tags: ["fda", "drug-label"] },
    { id: "src_icd10_25", name: "ICD-10-CM 2025 Code Set", kind: "CSV", pages: null, size: "12 MB", hash: "0x44b1aa97…ee03", indexed: "2026-09-01", citations: 1024, tags: ["coding", "billing"] },
    { id: "src_internal_v42", name: "Meridian Clinical Protocols v4.2", kind: "Markdown", pages: 96, size: "412 KB", hash: "0x3d8f0b22…9a17", indexed: "2026-10-22", citations: 88, tags: ["internal", "protocol"] },
  ],
  traceId: "af_x3k2qz9a8mn4lp2rt7yv",
  trace: {
    id: "af_x3k2qz9a8mn4lp2rt7yv",
    short: "af_x3k…7yv",
    app: "Encounter Summary Drafter",
    purpose: "discharge_summary",
    userTag: "clinician-9847",
    timestamp: "Oct 24, 2026 · 10:34:01.234 UTC",
    duration: "1.78s",
    cost: "$0.012",
    model: "gpt-4o-mini",
    provider: "OpenAI",
    tokensIn: 842,
    tokensOut: 392,
    piiEntities: 4,
    blockNumber: 1247,
    leaf: 23,
    bulletinDate: "2026-10-24",
    sealHash: "0xa3b9c4d27f201e8b9c4d27f201e8b3a3b9c4d27f201",
    sealHashShort: "0xa3b9c4d2…7f201",
  },
  // Claim catalog — keyed by verdict. Used by the right-panel step detail.
  claims: {
    verified: [
      {
        idx: 1, total: 3, verdict: "verified",
        text: "Metformin is contraindicated in patients with an eGFR below 30 mL/min/1.73m². Hold metformin and reassess renal function at follow-up.",
        sources: [
          { id: "src_fda_metf", name: "FDA Prescribing Information — Metformin HCl", span: "§5.1 Lactic Acidosis, p. 9", score: 96.4, quote: "Metformin is contraindicated in patients with eGFR below 30 mL/min/1.73m². Initiation of metformin in patients with eGFR between 30 and 45 mL/min/1.73m² is not recommended." },
        ],
        judges: [
          { name: "Judge A", model: "Lynx-8B", verdict: "verified", confidence: 0.97 },
          { name: "Judge B", model: "Claude 3.5", verdict: "verified", confidence: 0.94 },
          { name: "Judge C", model: "Gemini Pro 1.5", verdict: "verified", confidence: 0.95 },
        ],
        kappa: 0.92,
        kappaLabel: "Strong calibrated agreement",
      },
      {
        idx: 2, total: 3, verdict: "verified",
        text: "Initiate guideline-directed medical therapy with an ACE inhibitor or ARNI for HFrEF patients with LVEF ≤ 40%, unless contraindicated.",
        sources: [
          { id: "src_aha_hf24", name: "AHA/ACC Heart Failure Guidelines 2024", span: "§7.3.1 GDMT in HFrEF, p. 64", score: 91.2, quote: "In patients with HFrEF and LVEF ≤40%, an ACEi (or ARB if intolerant) or ARNI is recommended to reduce morbidity and mortality." },
        ],
        judges: [
          { name: "Judge A", model: "Lynx-8B", verdict: "verified", confidence: 0.93 },
          { name: "Judge B", model: "Claude 3.5", verdict: "verified", confidence: 0.91 },
          { name: "Judge C", model: "Gemini Pro 1.5", verdict: "verified", confidence: 0.96 },
        ],
        kappa: 0.89,
        kappaLabel: "Strong calibrated agreement",
      },
      {
        idx: 3, total: 3, verdict: "verified",
        text: "Schedule a 7-day post-discharge follow-up with the patient's primary care provider; document on the care plan.",
        sources: [
          { id: "src_internal_v42", name: "Meridian Clinical Protocols v4.2", span: "§3.4 Care transitions, p. 41", score: 98.1, quote: "All adult inpatient discharges must include a follow-up within 7 calendar days, scheduled before discharge." },
        ],
        judges: [
          { name: "Judge A", model: "Lynx-8B", verdict: "verified", confidence: 0.98 },
          { name: "Judge B", model: "Claude 3.5", verdict: "verified", confidence: 0.97 },
          { name: "Judge C", model: "Gemini Pro 1.5", verdict: "verified", confidence: 0.98 },
        ],
        kappa: 0.96,
        kappaLabel: "Strong calibrated agreement",
      },
    ],
    contradicted: [
      {
        idx: 2, total: 3, verdict: "contradicted",
        text: "Patients with HFrEF should be initiated on beta-blockers at the maximum tolerated dose immediately on admission to ensure rapid symptom control.",
        sources: [
          { id: "src_aha_hf24", name: "AHA/ACC Heart Failure Guidelines 2024", span: "§7.3.3 Beta-blocker initiation, p. 68", score: 94.7, quote: "Beta-blockers in HFrEF should be initiated at low doses and titrated to target doses over weeks to months. Rapid up-titration is not recommended and may precipitate decompensation." },
        ],
        judges: [
          { name: "Judge A", model: "Lynx-8B", verdict: "contradicted", confidence: 0.96 },
          { name: "Judge B", model: "Claude 3.5", verdict: "contradicted", confidence: 0.95 },
          { name: "Judge C", model: "Gemini Pro 1.5", verdict: "contradicted", confidence: 0.93 },
        ],
        kappa: 0.95,
        kappaLabel: "Strong calibrated agreement on contradiction",
        sourceContradictionNote: "The AHA/ACC guideline explicitly recommends slow titration. The claim recommends the opposite approach.",
      },
    ],
  },
  // Recent traces (for dashboard + traces list)
  recentTraces: [
    { id: "af_x3k…7yv", time: "10:34", app: "Encounter Summary", purpose: "discharge_summary", verdict: "verified", tokens: 1234, cost: "$0.012", isHighlight: true },
    { id: "af_q2m…1de", time: "10:32", app: "Encounter Summary", purpose: "discharge_summary", verdict: "verified", tokens: 982, cost: "$0.009" },
    { id: "af_8nm…rt4", time: "10:31", app: "Discharge Plan", purpose: "med_review", verdict: "partial", tokens: 412, cost: "$0.004" },
    { id: "af_5bp…ku9", time: "10:29", app: "Encounter Summary", purpose: "discharge_summary", verdict: "contradicted", tokens: 1540, cost: "$0.014" },
    { id: "af_pq3…hv6", time: "10:27", app: "Intake Triage", purpose: "symptom_summary", verdict: "verified", tokens: 678, cost: "$0.006" },
    { id: "af_w2k…aa1", time: "10:25", app: "Encounter Summary", purpose: "discharge_summary", verdict: "unverif", tokens: 543, cost: "$0.005" },
    { id: "af_n7e…b22", time: "10:23", app: "Discharge Plan", purpose: "med_review", verdict: "verified", tokens: 821, cost: "$0.008" },
    { id: "af_lm9…c0e", time: "10:21", app: "Encounter Summary", purpose: "discharge_summary", verdict: "verified", tokens: 1102, cost: "$0.011" },
    { id: "af_jx2…3vb", time: "10:18", app: "Intake Triage", purpose: "symptom_summary", verdict: "verified", tokens: 412, cost: "$0.004" },
    { id: "af_dt5…f04", time: "10:15", app: "Encounter Summary", purpose: "discharge_summary", verdict: "partial", tokens: 1234, cost: "$0.013" },
  ],
  verdictTotals: {
    verified: 7612,
    partial: 387,
    unverif: 136,
    contradicted: 112,
  },
  evidencePacks: [
    { id: "ep_q3_2026", name: "Q3 2026 HIPAA audit pack", range: "Jul 1 – Sep 30", calls: 8247, status: "ready", generated: "2026-10-15" },
    { id: "ep_oct_drafter", name: "Encounter Summary — October", range: "Oct 1 – Oct 23", calls: 1082, status: "ready", generated: "2026-10-23" },
    { id: "ep_q2_2026", name: "Q2 2026 HIPAA audit pack", range: "Apr 1 – Jun 30", calls: 6310, status: "ready", generated: "2026-07-15" },
  ],
};

window.SCENARIO = SCENARIO;

// Verdict metadata
const VERDICT = {
  verified:    { label: "Verified", color: "var(--verified)", soft: "var(--verified-soft)", iconName: "check", short: "Verified" },
  partial:     { label: "Partial",  color: "var(--partial)",  soft: "var(--partial-soft)",  iconName: "warning", short: "Partial" },
  unverif:     { label: "Unverifiable", color: "var(--unverif)", soft: "var(--unverif-soft)", iconName: "helpCircle", short: "Unverif." },
  contradicted:{ label: "Contradicted", color: "var(--contra)", soft: "var(--contra-soft)", iconName: "xCircle", short: "Contradicted" },
  contra:      { label: "Contradicted", color: "var(--contra)", soft: "var(--contra-soft)", iconName: "xCircle", short: "Contradicted" },
};
window.VERDICT = VERDICT;
