/* Sentosa Marketplace - SDC Admin module sample data */

/* Partner onboarding queue - Reply No. 4 Q10:
   partner submits registration with KYC documents → SDC sales team notified → SDC admin approves or rejects
   → on approval the account is auto-activated with automated agreement signing and eWallet linkage */
const PARTNER_APPS = [
  { ref: "APP-3081", name: "Sentosa Sky Adventures Pte Ltd", uen: "202418472K", category: "Attraction",
    contact: "Melissa Ong · partnerships@skyadventures.sg", submitted: "2 days ago", status: "Pending review",
    docs: [["ACRA Bizfile", true], ["Business licence", true], ["Public liability insurance", true], ["GST registration", false]],
    products: 6, note: "New luge-adjacent operator on Imbiah. Sales team pre-qualified 14 Jul." },
  { ref: "APP-3078", name: "Coastal Dining Group", uen: "201933104W", category: "Dining",
    contact: "Ryan Tan · ops@coastaldining.sg", submitted: "4 days ago", status: "Pending review",
    docs: [["ACRA Bizfile", true], ["Food shop licence", true], ["Halal certification", true], ["GST registration", true]],
    products: 11, note: "Operates three beachfront outlets. Referred by SDC F&B team." },
  { ref: "APP-3072", name: "Island Watersports Co", uen: "202201884D", category: "Experience",
    contact: "Nadia Ismail · hello@islandwater.sg", submitted: "1 week ago", status: "Information requested",
    docs: [["ACRA Bizfile", true], ["Safety certification", false], ["Public liability insurance", true], ["GST registration", true]],
    products: 4, note: "Awaiting updated MPA safety certification before approval." },
];

/* Product approval queue - S/No. 133, 134; Reply No. 4 Q3 (SnApp is source of truth) */
const PRODUCT_APPS = [
  { ref: "PRD-8841", name: "Sunset Cabin - Private", partner: "Sentosa Cable Car", type: "Experience",
    trade: 288.0, rack: 348.0, allot: 60, submitted: "Today, 09:14", status: "Pending review", kind: "Product" },
  { ref: "PRD-8839", name: "Heritage + Luge Combo", partner: "Fort Siloso · Skyline Luge", type: "Cross-partner bundle",
    trade: 41.0, rack: 54.0, allot: 400, submitted: "Yesterday", status: "Pending review", kind: "Bundle",
    components: ["Heritage Walking Tour · Fort Siloso · S$18.00", "Skyline Luge & Skyride · Skyline Luge · S$28.50"] },
  { ref: "PRD-8836", name: "Festive Season Pass", partner: "Sentosa Cable Car", type: "Ticket",
    trade: 42.0, rack: 52.0, allot: 500, submitted: "2 days ago", status: "Pending review", kind: "Product" },
];

/* Marketplace-wide promotions - SDC configures and approves centrally (Reply No. 4 Q13) */
const ADMIN_PROMOS = [
  { ref: "PRM-2041", name: "Early-bird September", mech: "Percentage", value: "12%", scope: "Cable Car Sky Pass",
    partner: "Sentosa Cable Car", period: "1-30 Sep 2026", status: "Live", redeemed: 384, uplift: 14.2 },
  { ref: "PRM-2038", name: "Combo bundle saver", mech: "Bundle", value: "S$6 off", scope: "Cable Car + Luge Combo",
    partner: "Sentosa Cable Car", period: "15 Aug - 15 Sep 2026", status: "Pending approval", redeemed: 0, uplift: 0 },
  { ref: "PRM-2035", name: "Island admission volume rebate", mech: "Fixed amount", value: "S$0.50 / ticket",
    scope: "Island Admission - Day Pass", partner: "SDC", period: "Q3 FY26", status: "Live", redeemed: 12480, uplift: 6.8 },
  { ref: "PRM-2030", name: "Card-linked weekend offer", mech: "Card-based", value: "8%", scope: "All products",
    partner: "Sentosa Cable Car", period: "Weekends, Aug 2026", status: "Rejected", redeemed: 0, uplift: 0 },
  { ref: "PRM-2028", name: "MICE welcome voucher", mech: "Coupon", value: "S$25", scope: "MICE Welcome Reception Pass",
    partner: "Sentosa MICE", period: "Aug - Dec 2026", status: "Live", redeemed: 96, uplift: 3.1 },
];

/* Loyalty - S/No. 86 commission, 87 rebate, 88 tiers */
const COMMISSION_RULES = [
  { partner: "Sentosa Cable Car", category: "Attraction", rate: 12.0, basis: "Selling rate", ytd: 184920 },
  { partner: "Skyline Luge", category: "Attraction", rate: 12.0, basis: "Selling rate", ytd: 132400 },
  { partner: "Marine Life Park", category: "Attraction", rate: 10.5, basis: "Selling rate", ytd: 241380 },
  { partner: "Tanjong Beach Club", category: "Dining", rate: 15.0, basis: "Selling rate", ytd: 78640 },
  { partner: "Sentosa MICE", category: "MICE", rate: 8.0, basis: "Selling rate", ytd: 96200 },
];

const REBATE_TIERS = [
  { tier: "Bronze", threshold: 0, rebate: 0, accounts: 214, colour: "#9A6B3E" },
  { tier: "Silver", threshold: 100000, rebate: 1.5, accounts: 168, colour: "#8A8A8A" },
  { tier: "Gold", threshold: 350000, rebate: 3.0, accounts: 82, colour: "#C9962E" },
  { tier: "Platinum", threshold: 750000, rebate: 4.5, accounts: 24, colour: "#5A6E8A" },
];

/* Accounts & campaigns - native fallback where Salesforce CRM is not activated (S/No. 154a) */
const ACCOUNTS = [
  { name: "Wanderlust Travel Pte Ltd", type: "Travel agent", tier: "Gold", subusers: 6, ytd: 412800, owner: "A. Lim", status: "Active", lastOrder: "Today" },
  { name: "Asia OTA Group", type: "OTA", tier: "Platinum", subusers: 14, ytd: 986400, owner: "A. Lim", status: "Active", lastOrder: "Today" },
  { name: "MICE Connect SG", type: "MICE organiser", tier: "Gold", subusers: 4, ytd: 388200, owner: "J. Chua", status: "Active", lastOrder: "Yesterday" },
  { name: "Island Hoppers", type: "Travel agent", tier: "Silver", subusers: 2, ytd: 142600, owner: "J. Chua", status: "Active", lastOrder: "3 days ago" },
  { name: "Pacific Corporate Travel", type: "Corporate", tier: "Silver", subusers: 8, ytd: 118900, owner: "A. Lim", status: "Dormant", lastOrder: "2 months ago" },
];

const CAMPAIGNS = [
  { ref: "CMP-411", name: "Q3 agent activation", channel: "Email + in-platform", segment: "Silver & Bronze agents",
    sent: 296, opened: 214, converted: 48, revenue: 128400, status: "Running", period: "Jul - Sep 2026" },
  { ref: "CMP-408", name: "MICE Q4 venue push", channel: "Email", segment: "MICE organisers",
    sent: 84, opened: 61, converted: 12, revenue: 214600, status: "Running", period: "Jul - Oct 2026" },
  { ref: "CMP-402", name: "Dormant account win-back", channel: "Email", segment: "No order in 90 days",
    sent: 142, opened: 68, converted: 9, revenue: 34200, status: "Completed", period: "May - Jun 2026" },
];

/* MICE - SDC MICE team view (S/No. 143) + enquiry queue (S/No. 144a) */
const ADMIN_ENQUIRIES = [
  { ref: "ENQ-10462", venue: "Tanjong Beach Club - Full Buyout", org: "Wanderlust Travel Pte Ltd", event: "Year-end Gala Dinner 2026",
    pax: 760, date: "12 Dec 2026", status: "New", owner: "Unassigned", received: "Just now" },
  { ref: "ENQ-10428", venue: "Imbiah Conference Suites", org: "MICE Connect SG", event: "APAC Partner Summit 2026",
    pax: 480, date: "18-19 Nov 2026", status: "Quote sent", owner: "J. Chua", received: "2 days ago" },
  { ref: "ENQ-10391", venue: "Siloso Beach Event Lawn", org: "Pacific Corporate Travel", event: "Year-end Gala Dinner",
    pax: 900, date: "12 Dec 2026", status: "In discussion", owner: "A. Lim", received: "5 days ago" },
  { ref: "ENQ-10355", venue: "Fort Siloso Heritage Hall", org: "Island Hoppers", event: "Incentive Group - Heritage Night",
    pax: 180, date: "4 Sep 2026", status: "Confirmed", owner: "J. Chua", received: "2 weeks ago" },
];

const ADMIN_VENUES = [
  { name: "Palawan Amphitheatre", partner: "Sentosa MICE", cap: 1200, rate: 8800, status: "Published", enquiries: 14 },
  { name: "Siloso Beach Event Lawn", partner: "Sentosa Beach Events", cap: 2500, rate: 12400, status: "Published", enquiries: 22 },
  { name: "Fort Siloso Heritage Hall", partner: "Fort Siloso", cap: 220, rate: 4200, status: "Published", enquiries: 9 },
  { name: "Sentosa Cove Waterfront Deck", partner: "Sentosa Marina", cap: 400, rate: 9600, status: "Published", enquiries: 11 },
  { name: "Imbiah Conference Suites", partner: "Sentosa MICE", cap: 600, rate: 7400, status: "Published", enquiries: 18 },
  { name: "Tanjong Beach Club - Full Buyout", partner: "Tanjong Beach Club", cap: 800, rate: 15800, status: "Draft", enquiries: 1 },
];

/* Reports register - S/No. 95-98, 100-102, 104-108 */
const ADMIN_REPORTS = [
  { sno: "95", name: "Master transaction report", group: "Transaction & financial" },
  { sno: "96", name: "Commission / incentive tracking report", group: "Transaction & financial" },
  { sno: "97", name: "Refund tracking report", group: "Transaction & financial" },
  { sno: "98", name: "eWallet transaction report", group: "Transaction & financial" },
  { sno: "100", name: "Account management report", group: "Business intelligence" },
  { sno: "101", name: "Account performance report", group: "Business intelligence" },
  { sno: "102", name: "Campaign performance tracking", group: "Business intelligence" },
  { sno: "104", name: "Inventory status report", group: "Product & inventory" },
  { sno: "105", name: "eTicket tracking report", group: "Product & inventory" },
  { sno: "106", name: "Revalidation tracking report", group: "Product & inventory" },
  { sno: "107", name: "Product performance report", group: "Product & inventory" },
  { sno: "108", name: "Product master report", group: "Product & inventory" },
];

/* Dashboard series */
const REVENUE_SERIES = [
  ["Jan", 412], ["Feb", 386], ["Mar", 448], ["Apr", 502], ["May", 478], ["Jun", 544],
  ["Jul", 612], ["Aug", 0], ["Sep", 0], ["Oct", 0], ["Nov", 0], ["Dec", 0],
];

/* AI auto-generated dashboard insights - S/No. 94(b); Reply No. 4 Q7 */
const AI_INSIGHTS = [
  { tone: "up", title: "Cross-partner bundles are outperforming single tickets",
    body: "Bundle orders are up 22% month-on-month and carry a 31% higher average order value than single-product orders. Three of the top five SKUs by revenue are bundles." },
  { tone: "warn", title: "Sky Dining allotment will exhaust before month end",
    body: "At the current 7-day run rate, Sky Dining Experience clears its remaining 64 units in about 11 days. Two agent accounts are driving 68% of that demand." },
  { tone: "flat", title: "Dormant accounts concentrated in the Silver tier",
    body: "18 Silver-tier accounts have not ordered in 90 days, representing roughly S$210k of lapsed annualised volume. The Q3 activation campaign has not yet reached this segment." },
];

/* Bank-transfer payments awaiting SDC Finance verification
   S/No. 72  Bank transfer - SDC Finance verifies receipt of funds before approving the transaction
   S/No. 74  Finance reconciliation reporting
   S/No. 117 Payment notification to Sales and Finance
   S/No. 133 Finance is the approving role in the workflow engine
   Reply No. 2 Q20/Q26: proof of payment → notify Sales & Finance → Finance matches and approves
                        → tickets released only on approval */
const PAYMENT_VERIFICATIONS = [
  { ref: "SDC-BT-00482", order: "SDC-00482", buyer: "Wanderlust Travel Pte Ltd", amount: 8420.00,
    submitted: "Today, 14:26", proof: "remittance-advice-2026-07-27.pdf", matched: true,
    bankRef: "SDC-BT-00482", received: 8420.00, status: "Awaiting verification", tickets: 200 },
  { ref: "SDC-BT-00478", order: "SDC-00478", buyer: "MICE Connect SG", amount: 4350.00,
    submitted: "Yesterday, 17:52", proof: "tt-advice-miceconnect.pdf", matched: true,
    bankRef: "SDC-BT-00478", received: 4350.00, status: "Awaiting verification", tickets: 71 },
  { ref: "SDC-BT-00469", order: "SDC-00469", buyer: "Horizon Tours (HK)", amount: 2680.00,
    submitted: "2 days ago", proof: "swift-mt103.pdf", matched: false,
    bankRef: "no reference quoted", received: 2645.00, status: "Exception", tickets: 40,
    note: "Received S$2,645.00 against S$2,680.00 invoiced - S$35.00 short, likely intermediary bank charges. No payment reference quoted on the transfer." },
];

Object.assign(window, { PAYMENT_VERIFICATIONS, PARTNER_APPS, PRODUCT_APPS, ADMIN_PROMOS, COMMISSION_RULES, REBATE_TIERS,
  ACCOUNTS, CAMPAIGNS, ADMIN_ENQUIRIES, ADMIN_VENUES, ADMIN_REPORTS, REVENUE_SERIES, AI_INSIGHTS });
