// Realistic fake data for transaction monitoring console.
// Entity names, account IDs, transaction patterns kept plausible but fictional.

const ALERTS = [
  {
    id: "ALT-26-04812",
    case: "CSE-26-1142",
    risk: 92,
    severity: "high",
    typology: "Structuring",
    rule: "R-204 · Multiple sub-threshold deposits",
    subject: "Ardent Maritime LLC",
    subjectType: "business",
    subjectCountry: "US",
    counterparty: "Krayton Holdings (BVI)",
    cpCountry: "VG",
    amount: 248500,
    currency: "USD",
    txnCount: 17,
    opened: "2026-05-14T09:12:00Z",
    sla: "2h 14m",
    slaWarn: true,
    assignee: "Jeffery E.",
    status: "open",
    channel: "ACH",
    score: { volume: 88, velocity: 94, geo: 41, peer: 76 },
    flagged: true,
  },
  {
    id: "ALT-26-04811",
    case: "CSE-26-1141",
    risk: 78,
    severity: "high",
    typology: "Sanctions",
    rule: "R-118 · OFAC SDN partial match",
    subject: "Halberd & Vance Ltd",
    subjectType: "business",
    subjectCountry: "GB",
    counterparty: "Vostok Trade Co.",
    cpCountry: "RU",
    amount: 1240000,
    currency: "USD",
    txnCount: 1,
    opened: "2026-05-14T08:48:00Z",
    sla: "5h 02m",
    slaWarn: false,
    assignee: "Marcus T.",
    status: "investigating",
    channel: "Wire",
    score: { volume: 56, velocity: 22, geo: 96, peer: 64 },
  },
  {
    id: "ALT-26-04810",
    case: "CSE-26-1140",
    risk: 71,
    severity: "high",
    typology: "Mule activity",
    rule: "R-307 · Fan-out pattern, 8 beneficiaries",
    subject: "Lila J. Sørensen",
    subjectType: "person",
    subjectCountry: "DK",
    counterparty: "8 beneficiaries",
    cpCountry: "—",
    amount: 56240,
    currency: "EUR",
    txnCount: 8,
    opened: "2026-05-14T07:31:00Z",
    sla: "6h 19m",
    slaWarn: false,
    assignee: "Jeffery E.",
    status: "open",
    channel: "SEPA",
    score: { volume: 62, velocity: 81, geo: 35, peer: 78 },
  },
  {
    id: "ALT-26-04809",
    case: "CSE-26-1139",
    risk: 64,
    severity: "med",
    typology: "Round-tripping",
    rule: "R-422 · Same-day reversal",
    subject: "Ortega Logistica SA",
    subjectType: "business",
    subjectCountry: "MX",
    counterparty: "Ortega Logistica SA · Acct 2",
    cpCountry: "MX",
    amount: 89400,
    currency: "MXN",
    txnCount: 4,
    opened: "2026-05-14T06:02:00Z",
    sla: "7h 48m",
    slaWarn: false,
    assignee: "Unassigned",
    status: "open",
    channel: "RTP",
    score: { volume: 71, velocity: 58, geo: 12, peer: 65 },
  },
  {
    id: "ALT-26-04808",
    case: "CSE-26-1138",
    risk: 58,
    severity: "med",
    typology: "PEP exposure",
    rule: "R-101 · New PEP linkage",
    subject: "Cassia Okonkwo",
    subjectType: "person",
    subjectCountry: "NG",
    counterparty: "Tier-1 Brokerage Inc.",
    cpCountry: "US",
    amount: 312000,
    currency: "USD",
    txnCount: 2,
    opened: "2026-05-14T05:24:00Z",
    sla: "8h 26m",
    slaWarn: false,
    assignee: "Yuki N.",
    status: "investigating",
    channel: "Wire",
    score: { volume: 58, velocity: 31, geo: 62, peer: 44 },
  },
  {
    id: "ALT-26-04807",
    case: "CSE-26-1137",
    risk: 52,
    severity: "med",
    typology: "Geographic risk",
    rule: "R-225 · High-risk corridor (TR↔AE)",
    subject: "Aydin Demir",
    subjectType: "person",
    subjectCountry: "TR",
    counterparty: "Emirates Gold DMCC",
    cpCountry: "AE",
    amount: 41200,
    currency: "USD",
    txnCount: 3,
    opened: "2026-05-14T04:55:00Z",
    sla: "8h 55m",
    slaWarn: false,
    assignee: "Yuki N.",
    status: "open",
    channel: "Wire",
    score: { volume: 45, velocity: 38, geo: 84, peer: 39 },
  },
  {
    id: "ALT-26-04806",
    case: "CSE-26-1136",
    risk: 48,
    severity: "med",
    typology: "Velocity",
    rule: "R-312 · 90d velocity ↑ 6.4×",
    subject: "Bridgewater Café Co.",
    subjectType: "business",
    subjectCountry: "US",
    counterparty: "Mixed (24)",
    cpCountry: "—",
    amount: 18450,
    currency: "USD",
    txnCount: 96,
    opened: "2026-05-14T03:30:00Z",
    sla: "10h 20m",
    slaWarn: false,
    assignee: "Marcus T.",
    status: "open",
    channel: "Card",
    score: { volume: 42, velocity: 76, geo: 8, peer: 31 },
  },
  {
    id: "ALT-26-04805",
    case: "CSE-26-1135",
    risk: 41,
    severity: "low",
    typology: "Cash intensity",
    rule: "R-510 · Cash deposits > 80%",
    subject: "Pine Hollow Auto Wash",
    subjectType: "business",
    subjectCountry: "US",
    counterparty: "Branch 218 (cash)",
    cpCountry: "US",
    amount: 14200,
    currency: "USD",
    txnCount: 12,
    opened: "2026-05-13T22:11:00Z",
    sla: "1d 14h",
    slaWarn: false,
    assignee: "Jeffery E.",
    status: "open",
    channel: "Cash",
    score: { volume: 38, velocity: 22, geo: 4, peer: 58 },
  },
  {
    id: "ALT-26-04804",
    case: "CSE-26-1134",
    risk: 36,
    severity: "low",
    typology: "Dormant reactivation",
    rule: "R-602 · 180d dormant + large inflow",
    subject: "Eleanor Marsh",
    subjectType: "person",
    subjectCountry: "US",
    counterparty: "Self · external bank",
    cpCountry: "US",
    amount: 6800,
    currency: "USD",
    txnCount: 1,
    opened: "2026-05-13T19:08:00Z",
    sla: "1d 19h",
    slaWarn: false,
    assignee: "Unassigned",
    status: "open",
    channel: "ACH",
    score: { volume: 22, velocity: 12, geo: 6, peer: 28 },
  },
  {
    id: "ALT-26-04803",
    case: "CSE-26-1133",
    risk: 28,
    severity: "low",
    typology: "Card · merchant risk",
    rule: "R-704 · MCC 7995 spend",
    subject: "Theo Reyes",
    subjectType: "person",
    subjectCountry: "PH",
    counterparty: "Aurora Gaming Ltd",
    cpCountry: "MT",
    amount: 920,
    currency: "USD",
    txnCount: 6,
    opened: "2026-05-13T16:42:00Z",
    sla: "2d 03h",
    slaWarn: false,
    assignee: "Auto-rules",
    status: "open",
    channel: "Card",
    score: { volume: 14, velocity: 18, geo: 41, peer: 22 },
  },
];

// Transactions for case detail view (focused on ALT-26-04812)
const CASE_TXNS = [
  { id: "TX-7741092", ts: "2026-05-14 09:08:42", dir: "in",  party: "Cash deposit · Branch 014",  acct: "—",                amount: 9800,  cur: "USD", chan: "Cash", flagged: true,  note: "Below $10k threshold" },
  { id: "TX-7741088", ts: "2026-05-14 09:02:14", dir: "in",  party: "Cash deposit · Branch 014",  acct: "—",                amount: 9700,  cur: "USD", chan: "Cash", flagged: true },
  { id: "TX-7740951", ts: "2026-05-14 08:51:09", dir: "in",  party: "Cash deposit · Branch 022",  acct: "—",                amount: 9900,  cur: "USD", chan: "Cash", flagged: true },
  { id: "TX-7740822", ts: "2026-05-14 08:33:51", dir: "out", party: "Krayton Holdings (BVI)",     acct: "•••• 4419",         amount: 28500, cur: "USD", chan: "Wire", flagged: true,  note: "First outflow to CP" },
  { id: "TX-7740611", ts: "2026-05-14 07:48:21", dir: "in",  party: "Cash deposit · Branch 014",  acct: "—",                amount: 9650,  cur: "USD", chan: "Cash" },
  { id: "TX-7740408", ts: "2026-05-13 17:22:09", dir: "in",  party: "Cash deposit · Branch 014",  acct: "—",                amount: 9800,  cur: "USD", chan: "Cash" },
  { id: "TX-7740311", ts: "2026-05-13 16:14:48", dir: "in",  party: "Cash deposit · Branch 022",  acct: "—",                amount: 9750,  cur: "USD", chan: "Cash" },
  { id: "TX-7740109", ts: "2026-05-13 15:01:22", dir: "out", party: "Krayton Holdings (BVI)",     acct: "•••• 4419",         amount: 41200, cur: "USD", chan: "Wire", flagged: true },
  { id: "TX-7739887", ts: "2026-05-13 11:48:01", dir: "in",  party: "Coastal Marine Supply Inc",  acct: "•••• 8842",         amount: 18420, cur: "USD", chan: "ACH" },
  { id: "TX-7739504", ts: "2026-05-13 09:32:11", dir: "in",  party: "Cash deposit · Branch 014",  acct: "—",                amount: 9900,  cur: "USD", chan: "Cash" },
  { id: "TX-7739401", ts: "2026-05-13 09:11:54", dir: "in",  party: "Cash deposit · Branch 014",  acct: "—",                amount: 9800,  cur: "USD", chan: "Cash" },
  { id: "TX-7738992", ts: "2026-05-12 16:48:32", dir: "out", party: "Payroll · Gusto",            acct: "•••• 1102",         amount: 14820, cur: "USD", chan: "ACH" },
  { id: "TX-7738744", ts: "2026-05-12 12:01:18", dir: "out", party: "Krayton Holdings (BVI)",     acct: "•••• 4419",         amount: 31000, cur: "USD", chan: "Wire", flagged: true },
  { id: "TX-7738501", ts: "2026-05-12 10:24:09", dir: "in",  party: "Cash deposit · Branch 022",  acct: "—",                amount: 9700,  cur: "USD", chan: "Cash" },
  { id: "TX-7738209", ts: "2026-05-12 09:11:43", dir: "in",  party: "Cash deposit · Branch 014",  acct: "—",                amount: 9850,  cur: "USD", chan: "Cash" },
];

// Activity / audit log for the case
const CASE_TIMELINE = [
  { ts: "2026-05-14 09:12", kind: "alert",   who: "System",     text: "Alert ALT-26-04812 generated — R-204 Structuring (score 92)" },
  { ts: "2026-05-14 09:14", kind: "assign",  who: "System",     text: "Auto-assigned to Jeffery E. (Tier-2 rotation)" },
  { ts: "2026-05-14 09:31", kind: "view",    who: "Jeffery E.",   text: "Opened case · pulled 90d transaction history" },
  { ts: "2026-05-14 09:47", kind: "note",    who: "Jeffery E.",   text: "Structuring pattern confirmed — 9 cash deposits at branches 014/022 between $9,650 and $9,900, all within 48h. Subject was on watchlist from 2025-Q4 SAR." },
  { ts: "2026-05-14 10:12", kind: "request", who: "Jeffery E.",   text: "Requested KYC refresh from Onboarding team" },
  { ts: "2026-05-14 10:34", kind: "link",    who: "Jeffery E.",   text: "Linked counterparty Krayton Holdings (BVI) to CSE-26-0982 (closed, related entity)" },
  { ts: "2026-05-14 11:02", kind: "edit",    who: "Jeffery E.",   text: "Escalated severity from medium to high" },
];

const KPIS = {
  alertsOpen:   { value: 187, delta: +12, label: "Open alerts" },
  highRisk:     { value:  34, delta:  +4, label: "High-risk" },
  slaBreached:  { value:   6, delta:  -2, label: "SLA-breached" },
  avgClose:     { value: "4h 12m", delta: "−18%", label: "Avg close time" },
  sarsFiled:    { value:  21, delta:  +3, label: "SARs filed · MTD" },
  falsePositive:{ value: "62%", delta: "−4pp", label: "False positive rate" },
};

// Sparkline series — small daily counts for last 30 days
const SPARK_ALERTS = [82, 91, 78, 88, 95, 102, 89, 76, 81, 94, 110, 124, 118, 99, 87, 92, 108, 121, 135, 142, 128, 119, 131, 145, 159, 152, 167, 172, 168, 187];
const SPARK_VOLUME = [40, 38, 45, 51, 48, 42, 50, 55, 58, 52, 49, 56, 61, 64, 60, 58, 65, 71, 69, 72, 76, 73, 78, 81, 79, 84, 88, 86, 91, 94];
const SPARK_CLOSE  = [5.2, 5.0, 5.4, 5.1, 4.8, 4.9, 5.3, 5.1, 4.7, 4.6, 4.5, 4.8, 4.6, 4.4, 4.5, 4.3, 4.4, 4.2, 4.3, 4.1, 4.0, 4.2, 4.1, 4.0, 4.2, 4.1, 4.0, 4.1, 4.0, 4.2];

const TYPOLOGY_DIST = [
  { name: "Structuring",        count: 48, pct: 25.7 },
  { name: "Velocity anomaly",   count: 34, pct: 18.2 },
  { name: "Mule activity",      count: 28, pct: 15.0 },
  { name: "PEP/Sanctions",      count: 22, pct: 11.8 },
  { name: "Geographic risk",    count: 19, pct: 10.2 },
  { name: "Round-tripping",     count: 14, pct:  7.5 },
  { name: "Cash intensity",     count: 12, pct:  6.4 },
  { name: "Other",              count: 10, pct:  5.3 },
];

const CORRIDOR_RISK = [
  { from: "US", to: "VG", risk: 84, vol: "$2.4M" },
  { from: "GB", to: "RU", risk: 92, vol: "$1.2M" },
  { from: "TR", to: "AE", risk: 78, vol: "$890K" },
  { from: "NG", to: "US", risk: 64, vol: "$1.1M" },
  { from: "MX", to: "MX", risk: 41, vol: "$3.2M" },
  { from: "DK", to: "EU", risk: 38, vol: "$2.8M" },
];

const QUEUE_BY_ASSIGNEE = [
  { who: "Jeffery E.",  init: "JE", open: 14, sla: 1,  color: "oklch(58% 0.16 28)" },
  { who: "Marcus T.", init: "MT", open: 11, sla: 0,  color: "oklch(58% 0.16 252)" },
  { who: "Yuki N.",   init: "YN", open:  9, sla: 0,  color: "oklch(58% 0.16 160)" },
  { who: "Devon A.",  init: "DA", open:  8, sla: 2,  color: "oklch(58% 0.16 320)" },
  { who: "Anya S.",   init: "AS", open:  6, sla: 0,  color: "oklch(58% 0.16 65)" },
];

Object.assign(window, {
  ALERTS, CASE_TXNS, CASE_TIMELINE, KPIS,
  SPARK_ALERTS, SPARK_VOLUME, SPARK_CLOSE,
  TYPOLOGY_DIST, CORRIDOR_RISK, QUEUE_BY_ASSIGNEE,
});
