// Customer risk-rating fixtures.
// Ratings: low (0–34) · med (35–59) · high (60–79) · severe (80–100)

const CUSTOMERS = [
  { id: "CST-12842", name: "Ardent Maritime LLC",       type: "business", country: "US", segment: "SMB · Maritime",
    onboarded: "2024-02-11", rating: "severe", score: 88, prior: "high", priorScore: 71,
    lastReview: "2026-04-22", nextReview: "2026-10-22", overdue: false,
    factors: { geo: 41, type: 62, product: 92, behavior: 96 },
    trend: [55, 58, 62, 65, 68, 71, 78, 88], flagged: true, reviewer: "Jeffery E.",
    reasons: ["Structuring pattern", "BVI counterparty", "Cash-intensive"] },
  { id: "CST-12671", name: "Halberd & Vance Ltd",       type: "business", country: "GB", segment: "Corporate · Trading",
    onboarded: "2023-08-04", rating: "severe", score: 84, prior: "high", priorScore: 72,
    lastReview: "2026-05-02", nextReview: "2026-11-02", overdue: false,
    factors: { geo: 92, type: 58, product: 74, behavior: 88 },
    trend: [60, 62, 65, 68, 70, 72, 78, 84], flagged: true, reviewer: "Marcus T.",
    reasons: ["Sanctions corridor exposure"] },
  { id: "CST-12509", name: "Krayton Holdings",          type: "business", country: "VG", segment: "Corporate · Holding",
    onboarded: "2025-01-15", rating: "high",   score: 78, prior: "med",  priorScore: 51,
    lastReview: "2026-03-30", nextReview: "2026-09-30", overdue: false,
    factors: { geo: 88, type: 71, product: 64, behavior: 82 },
    trend: [42, 45, 48, 51, 56, 62, 70, 78], flagged: true, reviewer: "Marcus T.",
    reasons: ["Offshore jurisdiction", "PEP linkage"] },
  { id: "CST-11823", name: "Cassia Okonkwo",            type: "person",   country: "NG", segment: "Private · PEP",
    onboarded: "2024-11-08", rating: "high",   score: 74, prior: "med",  priorScore: 54,
    lastReview: "2026-02-14", nextReview: "2026-08-14", overdue: false,
    factors: { geo: 62, type: 96, product: 51, behavior: 64 },
    trend: [48, 50, 52, 54, 58, 62, 68, 74], flagged: false, reviewer: "Yuki N.",
    reasons: ["PEP · senior public official"] },
  { id: "CST-11744", name: "Vostok Trade Co.",          type: "business", country: "RU", segment: "Corporate · Trading",
    onboarded: "2023-04-22", rating: "high",   score: 71, prior: "high", priorScore: 68,
    lastReview: "2026-01-18", nextReview: "2026-07-18", overdue: false,
    factors: { geo: 96, type: 52, product: 64, behavior: 58 },
    trend: [62, 64, 65, 66, 68, 69, 70, 71], flagged: false, reviewer: "Marcus T.",
    reasons: ["High-risk jurisdiction"] },
  { id: "CST-11302", name: "Aydin Demir",               type: "person",   country: "TR", segment: "Private · HNW",
    onboarded: "2024-05-09", rating: "high",   score: 67, prior: "med",  priorScore: 48,
    lastReview: "2025-12-04", nextReview: "2026-06-04", overdue: false,
    factors: { geo: 78, type: 41, product: 71, behavior: 64 },
    trend: [40, 42, 44, 48, 54, 60, 64, 67], flagged: false, reviewer: "Yuki N.",
    reasons: ["High-risk corridor (TR↔AE)"] },
  { id: "CST-11108", name: "Ortega Logistica SA",       type: "business", country: "MX", segment: "SMB · Logistics",
    onboarded: "2024-07-30", rating: "med",    score: 56, prior: "med",  priorScore: 51,
    lastReview: "2026-02-22", nextReview: "2026-08-22", overdue: false,
    factors: { geo: 54, type: 48, product: 62, behavior: 58 },
    trend: [48, 49, 50, 51, 52, 54, 55, 56], flagged: false, reviewer: "Devon A.",
    reasons: ["Round-tripping pattern"] },
  { id: "CST-10977", name: "Emirates Gold DMCC",        type: "business", country: "AE", segment: "Corporate · Precious metals",
    onboarded: "2022-11-12", rating: "med",    score: 52, prior: "low",  priorScore: 28,
    lastReview: "2025-11-30", nextReview: "2026-05-30", overdue: false,
    factors: { geo: 64, type: 71, product: 38, behavior: 41 },
    trend: [24, 26, 28, 32, 38, 44, 48, 52], flagged: true, reviewer: "Yuki N.",
    reasons: ["Industry · precious metals", "Volume step-up"] },
  { id: "CST-10844", name: "Lila J. Sørensen",          type: "person",   country: "DK", segment: "Private · Retail",
    onboarded: "2025-03-04", rating: "med",    score: 48, prior: "low",  priorScore: 22,
    lastReview: "2026-04-10", nextReview: "2026-10-10", overdue: false,
    factors: { geo: 28, type: 22, product: 64, behavior: 78 },
    trend: [18, 20, 22, 25, 31, 38, 44, 48], flagged: true, reviewer: "Jeffery E.",
    reasons: ["Mule-pattern behavior"] },
  { id: "CST-10721", name: "Bridgewater Café Co.",      type: "business", country: "US", segment: "SMB · Hospitality",
    onboarded: "2023-09-14", rating: "med",    score: 44, prior: "low",  priorScore: 28,
    lastReview: "2026-03-08", nextReview: "2026-09-08", overdue: false,
    factors: { geo: 8,  type: 34, product: 58, behavior: 76 },
    trend: [22, 24, 26, 28, 32, 36, 40, 44], flagged: false, reviewer: "Marcus T.",
    reasons: ["Velocity step-up"] },
  { id: "CST-10612", name: "Tier-1 Brokerage Inc.",     type: "business", country: "US", segment: "Corporate · Brokerage",
    onboarded: "2022-04-19", rating: "med",    score: 41, prior: "med",  priorScore: 42,
    lastReview: "2026-01-12", nextReview: "2026-07-12", overdue: false,
    factors: { geo: 12, type: 56, product: 48, behavior: 38 },
    trend: [44, 43, 42, 42, 41, 41, 41, 41], flagged: false, reviewer: "Devon A.",
    reasons: ["High-volume institutional"] },
  { id: "CST-10408", name: "Pine Hollow Auto Wash",     type: "business", country: "US", segment: "SMB · Retail",
    onboarded: "2023-02-04", rating: "med",    score: 38, prior: "low",  priorScore: 24,
    lastReview: "2025-10-22", nextReview: "2026-04-22", overdue: true,
    factors: { geo: 4,  type: 22, product: 58, behavior: 64 },
    trend: [20, 22, 24, 26, 28, 32, 34, 38], flagged: false, reviewer: "Unassigned",
    reasons: ["Cash intensity"] },
  { id: "CST-10204", name: "Coastal Marine Supply Inc", type: "business", country: "US", segment: "SMB · Wholesale",
    onboarded: "2021-07-08", rating: "low",    score: 28, prior: "low",  priorScore: 26,
    lastReview: "2026-02-04", nextReview: "2026-08-04", overdue: false,
    factors: { geo: 8,  type: 18, product: 32, behavior: 38 },
    trend: [24, 24, 25, 26, 26, 27, 28, 28], flagged: false, reviewer: "Anya S." },
  { id: "CST-10112", name: "Eleanor Marsh",             type: "person",   country: "US", segment: "Private · Retail",
    onboarded: "2020-05-22", rating: "low",    score: 24, prior: "low",  priorScore: 22,
    lastReview: "2025-09-14", nextReview: "2026-03-14", overdue: true,
    factors: { geo: 4,  type: 12, product: 24, behavior: 38 },
    trend: [18, 18, 19, 20, 21, 22, 23, 24], flagged: false, reviewer: "Unassigned" },
  { id: "CST-09887", name: "Theo Reyes",                type: "person",   country: "PH", segment: "Private · Retail",
    onboarded: "2024-09-22", rating: "low",    score: 22, prior: "low",  priorScore: 18,
    lastReview: "2026-04-04", nextReview: "2026-10-04", overdue: false,
    factors: { geo: 38, type: 12, product: 18, behavior: 22 },
    trend: [14, 15, 16, 17, 18, 20, 21, 22], flagged: false, reviewer: "Anya S." },
  { id: "CST-09712", name: "Saxon River Holdings",      type: "business", country: "US", segment: "Corporate · Investment",
    onboarded: "2021-11-30", rating: "low",    score: 18, prior: "low",  priorScore: 19,
    lastReview: "2026-03-22", nextReview: "2026-09-22", overdue: false,
    factors: { geo: 6,  type: 22, product: 14, behavior: 18 },
    trend: [21, 20, 20, 19, 19, 18, 18, 18], flagged: false, reviewer: "Devon A." },
  { id: "CST-09504", name: "Marisol Vega",              type: "person",   country: "US", segment: "Private · Retail",
    onboarded: "2019-03-08", rating: "low",    score: 14, prior: "low",  priorScore: 14,
    lastReview: "2026-01-30", nextReview: "2026-07-30", overdue: false,
    factors: { geo: 4,  type: 8,  product: 12, behavior: 18 },
    trend: [12, 13, 13, 13, 14, 14, 14, 14], flagged: false, reviewer: "Anya S." },
];

// Distribution
const RATING_DIST = {
  severe: { count: 24,  pct:  1.9, color: "var(--risk-high)" },
  high:   { count: 142, pct: 11.0, color: "oklch(64% 0.18 35)" },
  med:    { count: 386, pct: 30.0, color: "var(--risk-med)" },
  low:    { count: 736, pct: 57.1, color: "var(--risk-low)" },
};

// Risk-rating KPIs
const RR_KPIS = {
  total:       { value: "1,288",   label: "Rated customers",     delta: "+34" },
  severe:      { value: "24",      label: "Severe",              delta: "+3"  },
  newHigh:     { value: "8",       label: "Newly high-risk · 30d", delta: "+5"  },
  reratedMTD:  { value: "126",     label: "Re-rated · MTD",      delta: "+18" },
  avgScore:    { value: "31.4",    label: "Avg risk score",      delta: "+1.2"},
  pendingRefresh:{ value: "47",    label: "Pending refresh",     delta: "−6"  },
};

// Periodic review KPIs
const PR_KPIS = {
  dueMonth:    { value: "84",  label: "Due this month",   delta: "+12" },
  overdue:     { value: "9",   label: "Overdue",          delta: "+3"  },
  completed:   { value: "126", label: "Completed · MTD",  delta: "+18" },
  ratingChanges:{ value: "42", label: "Rating changes",   delta: "+11" },
  escalations: { value: "11",  label: "Escalations",      delta: "+4"  },
  avgCycle:    { value: "3.2d",label: "Avg cycle time",   delta: "−0.4d" },
};

// Migration matrix — rows = prior rating, cols = new rating (in 30 days)
// [low, med, high, severe] in both axes
const MIGRATION = {
  rows: ["low", "med", "high", "severe"],
  cells: [
    //   →low  →med  →high →sev
    /* low ↓*/    [248,   18,    4,    0],
    /* med ↓*/    [ 12,   88,   11,    1],
    /* high ↓*/   [  2,    7,   42,    3],
    /* severe ↓*/ [  0,    1,    2,   17],
  ],
};

// Periodic review log — recent completed reviews
const REVIEWS = [
  { id: "REV-7741", customer: "Ardent Maritime LLC",  prior: "high",  new: "severe", scoreDelta: +17, reviewer: "Jeffery E.",  completed: "2026-05-14 11:02", reason: "Structuring pattern · escalated from L2 case", flagged: true },
  { id: "REV-7738", customer: "Lila J. Sørensen",     prior: "low",   new: "med",    scoreDelta: +26, reviewer: "Jeffery E.",  completed: "2026-05-14 10:18", reason: "Mule-pattern fan-out · 8 beneficiaries", flagged: true },
  { id: "REV-7732", customer: "Krayton Holdings",     prior: "med",   new: "high",   scoreDelta: +27, reviewer: "Marcus T.", completed: "2026-05-13 16:48", reason: "Offshore + PEP linkage discovered", flagged: true },
  { id: "REV-7728", customer: "Emirates Gold DMCC",   prior: "low",   new: "med",    scoreDelta: +24, reviewer: "Yuki N.",   completed: "2026-05-13 14:22", reason: "Volume step-up · industry recalibration", flagged: false },
  { id: "REV-7724", customer: "Bridgewater Café Co.", prior: "low",   new: "med",    scoreDelta: +16, reviewer: "Marcus T.", completed: "2026-05-13 11:09", reason: "90d velocity ↑ 6.4×", flagged: false },
  { id: "REV-7719", customer: "Aydin Demir",          prior: "med",   new: "high",   scoreDelta: +19, reviewer: "Yuki N.",   completed: "2026-05-12 17:54", reason: "TR↔AE corridor + EDD outcome", flagged: true },
  { id: "REV-7714", customer: "Halberd & Vance Ltd",  prior: "high",  new: "severe", scoreDelta: +12, reviewer: "Marcus T.", completed: "2026-05-12 14:31", reason: "OFAC partial match · L3 review", flagged: true },
  { id: "REV-7708", customer: "Cassia Okonkwo",       prior: "med",   new: "high",   scoreDelta: +20, reviewer: "Yuki N.",   completed: "2026-05-12 10:48", reason: "Confirmed PEP · senior public official", flagged: false },
  { id: "REV-7702", customer: "Ortega Logistica SA",  prior: "med",   new: "med",    scoreDelta:  +5, reviewer: "Devon A.",  completed: "2026-05-11 16:12", reason: "Round-tripping noted but within tolerance", flagged: false },
  { id: "REV-7697", customer: "Saxon River Holdings", prior: "low",   new: "low",    scoreDelta:  -1, reviewer: "Devon A.",  completed: "2026-05-11 13:40", reason: "Annual review · no material change", flagged: false },
  { id: "REV-7691", customer: "Marisol Vega",         prior: "low",   new: "low",    scoreDelta:   0, reviewer: "Anya S.",   completed: "2026-05-11 09:22", reason: "Annual review · stable", flagged: false },
  { id: "REV-7685", customer: "Theo Reyes",           prior: "low",   new: "low",    scoreDelta:  +4, reviewer: "Anya S.",   completed: "2026-05-10 15:08", reason: "Card · gaming MCC noted", flagged: false },
];

// 12-month rating-trend stacked time series (counts per tier per month)
const RATING_TREND = [
  // [low, med, high, severe]
  { m: "Jun", low: 718, med: 358, high: 122, severe: 18 },
  { m: "Jul", low: 722, med: 364, high: 124, severe: 18 },
  { m: "Aug", low: 728, med: 368, high: 128, severe: 19 },
  { m: "Sep", low: 731, med: 372, high: 131, severe: 19 },
  { m: "Oct", low: 729, med: 376, high: 132, severe: 20 },
  { m: "Nov", low: 733, med: 378, high: 134, severe: 20 },
  { m: "Dec", low: 731, med: 381, high: 135, severe: 21 },
  { m: "Jan", low: 734, med: 382, high: 136, severe: 21 },
  { m: "Feb", low: 736, med: 380, high: 138, severe: 22 },
  { m: "Mar", low: 738, med: 382, high: 140, severe: 22 },
  { m: "Apr", low: 737, med: 384, high: 141, severe: 23 },
  { m: "May", low: 736, med: 386, high: 142, severe: 24 },
];

// Risk factor distribution at population level
const FACTOR_AVG = [
  { key: "geo",      label: "Geographic",     value: 22, max: 100 },
  { key: "type",     label: "Customer type",  value: 31, max: 100 },
  { key: "product",  label: "Products used",  value: 28, max: 100 },
  { key: "behavior", label: "Behavior",       value: 34, max: 100 },
];

Object.assign(window, {
  CUSTOMERS, RATING_DIST, RR_KPIS, PR_KPIS, MIGRATION, REVIEWS, RATING_TREND, FACTOR_AVG,
});
