// Data for the regulatory surfaces (Statutory Filings, AML Training, Officers, CESRA)
// plus the canonical Customer Risk Assessment (CRA) rubric values sourced from
// `Risk Guidelines.pdf` (Brian, 2026-05-20). Tracking gap-closure in issue #3143.
// All names/IDs are fictional or public-record.

// FATF jurisdiction lists — source: Risk Guidelines.pdf §1 (page 1).
// Black = FATF Call-for-Action + EU Annex I (mandatory EDD + Senior Mgmt approval).
// Grey  = FATF Increased Monitoring + EU Annex II (heightened scrutiny + tailored EDD).
// Any country not in either list defaults to Low (Standard CDD).
const FATF_LISTS = {
  black: ["KP", "IR", "MM"],
  grey: [
    "DZ",
    "AO",
    "BO",
    "BG",
    "CM",
    "CI",
    "CD",
    "HT",
    "KE",
    "KW",
    "LA",
    "LB",
    "MX",
    "MC",
    "NA",
    "NP",
    "PG",
    "SS",
    "SY",
    "VE",
    "VG",
    "YE",
    "BZ",
    "BN",
    "SZ",
    "GL",
    "JO",
    "ME",
    "MA",
    "TR",
    "AS",
    "AI",
    "GU",
    "PW",
    "PA",
    "RU",
    "TC",
    "VI",
    "VU",
    "VN"
  ]
};

const fatfTier = (iso2) => {
  if (!iso2) return "low";
  if (FATF_LISTS.black.includes(iso2)) return "black";
  if (FATF_LISTS.grey.includes(iso2)) return "grey";
  return "low";
};

// Customer Risk Assessment thresholds — source: Risk Guidelines.pdf §3 (page 3).
// USD bands are annual aggregates, wire-volume is transfers-per-annum, statutory
// review cadence is months (PDF expresses as years; converted for the slider UI).
const CRA_TX_TIERS = {
  low: { usdMax: 250_000, wireMax: 12, reviewMonths: 60, reviewLabel: "5–10 years", ddRegime: "SDD" },
  medium: { usdMax: 1_000_000, wireMax: 30, reviewMonths: 48, reviewLabel: "3–5 years", ddRegime: "CDD" },
  high: { usdMax: Infinity, wireMax: Infinity, reviewMonths: 12, reviewLabel: "1 year (annual)", ddRegime: "EDD" }
};

Object.assign(window, { FATF_LISTS, fatfTier, CRA_TX_TIERS });

const STATUTORY_FILINGS = {
  ioeama: [
    { instrument: "Afghanistan Order 2018 §24", period: "2022", due: "2023-01-31", status: "Overdue", note: "SCB compliance directive 2026-03-30" },
    { instrument: "Afghanistan Order 2018 §24", period: "2023", due: "2024-01-31", status: "Overdue", note: "SCB compliance directive 2026-03-30" },
    { instrument: "Afghanistan Order 2018 §24", period: "2024", due: "2025-01-31", status: "Overdue", note: "SCB compliance directive 2026-03-30" },
    { instrument: "Iraq Order 2018 §24", period: "2022", due: "2023-01-31", status: "Overdue", note: "SCB compliance directive 2026-03-30" },
    { instrument: "Iraq Order 2018 §24", period: "2023", due: "2024-01-31", status: "Overdue", note: "SCB compliance directive 2026-03-30" },
    { instrument: "Iraq Order 2018 §24", period: "2024", due: "2025-01-31", status: "Overdue", note: "SCB compliance directive 2026-03-30" },
    { instrument: "DPRK Order 2019 §15", period: "2023", due: "2024-01-31", status: "Overdue", note: "SCB compliance directive 2026-03-30" },
    { instrument: "DPRK Order 2019 §15", period: "2024", due: "2025-01-31", status: "Overdue", note: "SCB compliance directive 2026-03-30" },
    { instrument: "Iran Order 2019 §14", period: "2024", due: "2025-01-31", status: "Overdue", note: "SCB compliance directive 2026-03-30" },
    { instrument: "All 4 orders · 2025 cycle", period: "2025", due: "2026-01-31", status: "Drafted", evidence: "declarations-2025.pdf", note: "Reviewed by Alva 2026-04-22" }
  ],
  ata: [
    { instrument: "Q1 2024", period: "2024", due: "2024-04-30", status: "FIU referral", note: "Awaiting Alva input" },
    { instrument: "Q2 2024", period: "2024", due: "2024-07-31", status: "FIU referral", note: "Awaiting Alva input" },
    { instrument: "Q3 2024", period: "2024", due: "2024-10-31", status: "FIU referral", note: "Awaiting Alva input" },
    { instrument: "Q4 2024", period: "2024", due: "2025-01-31", status: "FIU referral", note: "Awaiting Alva input" },
    { instrument: "Q1 2025", period: "2025", due: "2025-04-30", status: "Drafted", evidence: "q1-2025-nil-return.pdf", note: "Nil return — no flagged props" },
    { instrument: "Q2 2025", period: "2025", due: "2025-07-31", status: "Drafted", evidence: "q2-2025-nil-return.pdf", note: "Nil return — no flagged props" },
    { instrument: "Q1 2026", period: "2026", due: "2026-04-30", status: "Submitted", evidence: "q1-2026.pdf", ackRef: "FIU-2026-05-02-q1", note: "FIU ack 2026-05-02" }
  ],
  aeoi: [
    { instrument: "CRS report", period: "2023", due: "2024-08-22", status: "Accepted", evidence: "crs-2023.zip", ackRef: "AEOI-2024-08-A411", note: "Standard reporting" },
    { instrument: "FATCA report", period: "2023", due: "2024-08-22", status: "Accepted", evidence: "fatca-2023.zip", ackRef: "AEOI-2024-08-F411", note: "Standard reporting" },
    { instrument: "CRS report", period: "2024", due: "2025-08-22", status: "Submitted", evidence: "crs-2024.zip", note: "Absorbed by incoming CTO post-predecessor exit (17h)" },
    {
      instrument: "CRS registration (Amendment Act 2026)",
      period: "2026",
      due: "2026-06-15",
      status: "Drafted",
      note: "Mandatory registration · $300K ceiling activates after deadline"
    }
  ]
};

const AML_TRAINING = [
  {
    name: "Vincent Keel",
    role: "CFO",
    years: [{ status: "missed" }, { status: "missed" }, { status: "missed" }, { status: "completed", date: "2025-08-14", evidence: "keel-2025.pdf" }, { status: "scheduled" }]
  },
  {
    name: "Kayla Cole",
    role: "Director",
    years: [
      { status: "missed" },
      { status: "missed" },
      { status: "completed", date: "2024-11-02", evidence: "cole-2024.pdf" },
      { status: "completed", date: "2025-09-18", evidence: "cole-2025.pdf" },
      { status: "scheduled" }
    ]
  },
  {
    name: "Hassan Bell",
    role: "Ops",
    years: [
      { status: "completed", date: "2022-09-21", evidence: "bell-2022.pdf" },
      { status: "missed" },
      { status: "completed", date: "2024-08-10", evidence: "bell-2024.pdf" },
      { status: "completed", date: "2025-10-03", evidence: "bell-2025.pdf" },
      { status: "scheduled" }
    ]
  },
  {
    name: "Bram Janssen",
    role: "CEO",
    years: [
      { status: "completed", date: "2022-06-04" },
      { status: "completed", date: "2023-06-19" },
      { status: "completed", date: "2024-07-08" },
      { status: "completed", date: "2025-07-22" },
      { status: "completed", date: "2026-04-11" }
    ]
  },
  {
    name: "Elias Brandt",
    role: "CTO",
    years: [
      { status: "completed", date: "2022-06-04" },
      { status: "completed", date: "2023-06-19" },
      { status: "completed", date: "2024-07-08" },
      { status: "completed", date: "2025-07-22" },
      { status: "completed", date: "2026-04-11" }
    ]
  },
  {
    name: "Caleb Whitcombe",
    role: "CIO",
    years: [
      { status: "completed", date: "2022-07-12" },
      { status: "completed", date: "2023-07-04" },
      { status: "completed", date: "2024-08-22" },
      { status: "completed", date: "2025-09-01" },
      { status: "completed", date: "2026-05-05" }
    ]
  },
  {
    name: "Aria Holloway",
    role: "Compliance / MLRO",
    years: [{ status: "na" }, { status: "na" }, { status: "na" }, { status: "completed", date: "2025-09-04" }, { status: "completed", date: "2026-03-19" }]
  }
];

const OFFICERS = {
  current: {
    initials: "AH",
    name: "Aria Holloway",
    role: "MLRO · Compliance Officer",
    since: "2025-08-25",
    scbNotified: "2025-08-26",
    evidence: "scb-mlro-change-AH.pdf"
  },
  history: [
    { period: "2025-08-25 → present", name: "Aria Holloway", role: "MLRO / CO", notified: "2025-08-26", evidence: "scb-mlro-change-AH.pdf" },
    { period: "2024-01-08 → 2025-08-24", name: "Calvin Pierce Jr.", role: "MLRO / CO", notified: "Missed", fineNote: "SCB fine $2,500" },
    { period: "2022-04-01 → 2024-01-07", name: "Selma Wright", role: "MLRO / CO", notified: "2024-01-12", evidence: "scb-mlro-change-SW-CP.pdf" }
  ],
  roster: [
    { role: "MLRO / Compliance Officer", name: "Aria Holloway", since: "2025-08-25", notified: true },
    { role: "Deputy MLRO", name: null, since: null, notified: false },
    { role: "Director — Compliance", name: "Bram Janssen", since: "2018-02-12", notified: true },
    { role: "CFO", name: "Vincent Keel", since: "2022-05-04", notified: true }
  ]
};

const CESRA = {
  fields: [
    { label: "Reporting entity", value: "Agio Fund Services Ltd.", autopull: "auto-pulled from organization registry" },
    { label: "Licence number", value: "IFA-U-96", autopull: "auto-pulled from AgioPlatform.vw_cesra_reporting" },
    { label: "Reporting period", value: "FY2025 (Jan 1 – Dec 31, 2025)" },
    { label: "Relevant activity", value: "Fund management business" },
    { label: "Average FTEs in Bahamas", value: "6", autopull: "from employee register · 6 active 2025" },
    { label: "Operating expenditure (USD)", value: "412,500", autopull: "from fund-accounting ledger" },
    { label: "Board meetings in Bahamas", value: "4", autopull: "from board-minutes registry" }
  ],
  preview: `ENTITY:            Agio Fund Services Ltd.
LICENCE:           IFA-U-96
PERIOD:            FY2025 (2025-01-01 → 2025-12-31)
ACTIVITY_TYPE:     fund_management_business

CORE_INCOME_GENERATING_ACTIVITIES:
  - Taking decisions on holding/selling investments
  - Calculating risks / reserves
  - Taking decisions on currency / interest fluctuations
  - Preparing relevant regulatory returns

ADEQUATE_PERSONS:  6 FTE
EXPENDITURE_USD:   412,500
PHYSICAL_PRESENCE: Sandyport, Nassau (lease confirmed)
BOARD_MEETINGS:    4 (all in Bahamas, quorum maintained)

ATTACHMENTS:
  - Lease agreement (Sandyport)
  - Audited financials 2025
  - Board minutes Q1–Q4 2025
  - Employee payroll register

DECLARATION_SIGNATORY: Bram Janssen, CEO
DATE:              2026-05-19 (draft)`,
  history: [
    { cycle: "FY2025", filed: "draft 2026-05-19", status: "Drafted", tone: "warn", ack: null },
    { cycle: "FY2024", filed: "—", status: "Missing", tone: "bad", ack: "to be back-filed in same submission" },
    { cycle: "FY2023", filed: "2024-02-14", status: "Accepted", tone: "ok", ack: "OED-2024-02-A411" },
    { cycle: "FY2022", filed: "2023-02-09", status: "Accepted", tone: "ok", ack: "OED-2023-02-A188" }
  ]
};

Object.assign(window, { STATUTORY_FILINGS, AML_TRAINING, OFFICERS, CESRA });
