/**
 * Shared dashboard route map: action -> REST spec { method, path(m), body?(m) }.
 * Copy of background.js's DASHBOARD_ROUTES so the /web build (web-shim.js) can fall
 * back to it and reach EVERY server-backed action, not just its curated subset.
 * background.js keeps its own copy (editing the extension SW core can't be E2E-tested
 * here); dashboard-routes.drift.test.js fails if the two key sets diverge. Loaded by the
 * web page via <script src=/web/dashboard-routes.js> as a classic script that sets
 * globalThis.NEXUS_DASHBOARD_ROUTES (same pattern as automation-registry.js); node reads
 * that same global after importing this file (the repo is type:module, so no CJS export).
 */
"use strict";
{
  const DASHBOARD_ROUTES = {
    // Campaign creation
    "campaign-dm-create": {
      method: "POST",
      path: () => `/api/campaigns/dm/create`,
      body: (m) => m.body,
    },
    "campaign-email-create": {
      method: "POST",
      path: () => `/api/campaigns/email/create`,
      body: (m) => m.body,
    },

    // Accounts + Settings
    "accounts-all": { method: "GET", path: () => `/api/accounts/all` },
    "connections-test": {
      method: "POST",
      path: () => `/api/connections/test`,
      body: (m) => m.body,
    },
    "manual-login": {
      method: "POST",
      path: () => `/api/accounts/manual-login`,
      body: (m) => m.body,
    },
    "manual-login-status": {
      method: "GET",
      path: (m) => `/api/accounts/manual-login/status${m.queryString || ""}`,
    },
    // Telegram (MTProto) in-dashboard add flow
    "tg-add-start": {
      method: "POST",
      path: () => `/api/accounts/telegram/start`,
      body: (m) => m.body || {},
    },
    "tg-add-code": {
      method: "POST",
      path: () => `/api/accounts/telegram/code`,
      body: (m) => m.body || {},
    },
    "tg-add-password": {
      method: "POST",
      path: () => `/api/accounts/telegram/password`,
      body: (m) => m.body || {},
    },
    "tg-add-cancel": {
      method: "POST",
      path: () => `/api/accounts/telegram/cancel`,
      body: (m) => m.body || {},
    },
    "activity-feed": { method: "GET", path: (m) => `/api/activity/feed${m.queryString || ""}` },
    "twitter-run-shots": {
      method: "GET",
      path: (m) => `/api/twitter/run-shots${m.queryString || ""}`,
    },
    today: { method: "GET", path: () => `/api/today` },
    // Earn section + Circuit bridge — quest seam reads (both read-only)
    "quests-summary": { method: "GET", path: () => `/api/quests/summary` },
    "mutuals-summary": { method: "GET", path: () => `/api/mutuals/summary` },
    "mutuals-subscriptions": { method: "GET", path: () => `/api/mutuals/subscriptions` },
    "mutuals-subscribe": {
      method: "POST",
      path: () => `/api/mutuals/subscriptions`,
      body: (m) => m.body || {},
    },
    "mutuals-sub-items": {
      method: "PATCH",
      path: (m) => `/api/mutuals/subscriptions/${encodeURIComponent(m.id)}/items`,
      body: (m) => m.body || {},
    },
    "engine-health": { method: "GET", path: () => `/api/engine/health` },
    "stats-overview": { method: "GET", path: (m) => `/api/stats/overview${m.queryString || ""}` },
    "settings-get": { method: "GET", path: () => `/api/settings` },
    "settings-update": { method: "POST", path: () => `/api/settings/update`, body: (m) => m.body },
    "admin-trigger": { method: "POST", path: () => `/api/admin/trigger`, body: (m) => m.body },
    "report-get": { method: "GET", path: () => `/api/report` },
    "crm-export": { method: "GET", path: (m) => `/api/crm/contacts/export${m.queryString || ""}` },

    // Campaigns
    "campaigns-dm": { method: "GET", path: (m) => `/api/campaigns/dm${m.queryString || ""}` },
    "campaigns-email": { method: "GET", path: (m) => `/api/campaigns/email${m.queryString || ""}` },
    "campaigns-outreach": {
      method: "GET",
      path: (m) => `/api/campaigns/outreach${m.queryString || ""}`,
    },
    "campaigns-stats": { method: "GET", path: () => `/api/campaigns/stats` },
    "campaigns-all": { method: "GET", path: (m) => `/api/campaigns/all${m.queryString || ""}` },
    "campaigns-action": {
      method: "POST",
      path: () => `/api/campaigns/action`,
      body: (m) => m.body,
    },
    "campaigns-detail": {
      method: "GET",
      path: (m) => `/api/campaigns/detail${m.queryString || ""}`,
    },
    "campaign-detail": {
      method: "GET",
      path: (m) => `/api/campaigns/${encodeURIComponent(m.type)}/${encodeURIComponent(m.id)}`,
    },
    "campaign-action": {
      method: "POST",
      path: (m) =>
        `/api/campaigns/${encodeURIComponent(m.type)}/${encodeURIComponent(m.id)}/${encodeURIComponent(m.operation)}`,
    },

    // Signals
    "signals-list": { method: "GET", path: (m) => `/api/signals${m.queryString || ""}` },
    "signals-keywords-list": { method: "GET", path: () => `/api/signals/keywords` },
    "signals-keywords-add": {
      method: "POST",
      path: () => `/api/signals/keywords`,
      body: (m) => m.body,
    },
    "signals-keywords-delete": {
      method: "DELETE",
      path: (m) => `/api/signals/keywords/${encodeURIComponent(m.keywordId)}`,
    },
    "signal-preview": {
      method: "GET",
      path: (m) => `/api/signals/${encodeURIComponent(m.signalId)}/preview`,
    },
    "signal-regen-comment": {
      method: "POST",
      path: (m) => `/api/signals/${encodeURIComponent(m.signalId)}/regenerate-comment`,
    },
    "signal-publish": {
      method: "POST",
      path: (m) => `/api/signals/${encodeURIComponent(m.signalId)}/publish`,
      body: (m) => m.body,
    },
    "signal-dismiss": {
      method: "POST",
      path: (m) => `/api/signals/${encodeURIComponent(m.signalId)}/dismiss`,
    },
    "signal-status": {
      method: "GET",
      path: (m) => `/api/signals/${encodeURIComponent(m.signalId)}/status`,
    },
    "signals-setup-from-url": {
      method: "POST",
      path: () => `/api/signals/setup-from-url`,
      body: (m) => m.body,
    },

    // VC Outreach
    "vc-queue": { method: "GET", path: () => `/api/vc-outreach/queue` },
    "vc-detail": {
      method: "GET",
      path: (m) => `/api/vc-outreach/${encodeURIComponent(m.investorId)}`,
    },
    "vc-scrape": {
      method: "POST",
      path: (m) => `/api/vc-outreach/${encodeURIComponent(m.investorId)}/scrape`,
    },
    "vc-generate": {
      method: "POST",
      path: (m) =>
        `/api/vc-outreach/${encodeURIComponent(m.investorId)}/${encodeURIComponent(m.contactId)}/${encodeURIComponent(m.companyId)}/generate`,
    },
    "vc-publish": {
      method: "POST",
      path: (m) =>
        `/api/vc-outreach/${encodeURIComponent(m.investorId)}/${encodeURIComponent(m.contactId)}/${encodeURIComponent(m.companyId)}/publish`,
      body: (m) => m.body,
    },
    "vc-campaigns": { method: "GET", path: () => `/api/vc-outreach/campaigns` },
    "vc-auto-queue": {
      method: "POST",
      path: () => `/api/vc-outreach/auto-queue`,
      body: (m) => m.body,
    },

    // CRM browse
    "crm-contacts-list": { method: "GET", path: (m) => `/api/crm/contacts${m.queryString || ""}` },
    // CRM-as-a-source for the Composer (Part F.1): segment preview + facet options
    "crm-segment": { method: "GET", path: (m) => `/api/crm/segment${m.queryString || ""}` },
    "crm-segment-options": {
      method: "GET",
      path: (m) => `/api/crm/segment/options${m.queryString || ""}`,
    },
    "crm-segment-ids": { method: "GET", path: (m) => `/api/crm/segment/ids${m.queryString || ""}` },
    "crm-companies-list": {
      method: "GET",
      path: (m) => `/api/crm/companies${m.queryString || ""}`,
    },
    "crm-search": { method: "GET", path: (m) => `/api/crm/search${m.queryString || ""}` },
    "crm-enrichment-recent": {
      method: "GET",
      path: (m) => `/api/crm/enrichment/recent${m.queryString || ""}`,
    },
    "crm-lead-analysis": {
      method: "POST",
      path: () => `/api/crm/lead-analysis`,
      body: (m) => m.body,
    },
    "crm-lead-analysis-bulk": {
      method: "POST",
      path: () => `/api/crm/lead-analysis/bulk`,
      body: (m) => m.body,
    },
    "crm-lead-analysis-bulk-get": {
      method: "GET",
      path: (m) => `/api/crm/lead-analysis/bulk/${encodeURIComponent(m.jobId)}`,
    },
    "crm-lead-analysis-bulk-cancel": {
      method: "POST",
      path: (m) => `/api/crm/lead-analysis/bulk/${encodeURIComponent(m.jobId)}/cancel`,
    },
    // v63 bulk enrich — companies + contacts share the /api/crm/enrich/bulk/:id
    // poll + cancel namespace; only the start endpoint differs by entity kind.
    "crm-companies-enrich-bulk": {
      method: "POST",
      path: () => `/api/crm/companies/enrich/bulk`,
      body: (m) => m.body,
    },
    "crm-contacts-enrich-bulk": {
      method: "POST",
      path: () => `/api/crm/contacts/enrich/bulk`,
      body: (m) => m.body,
    },
    "crm-enrich-bulk-get": {
      method: "GET",
      path: (m) => `/api/crm/enrich/bulk/${encodeURIComponent(m.jobId)}`,
    },
    "crm-enrich-bulk-cancel": {
      method: "POST",
      path: (m) => `/api/crm/enrich/bulk/${encodeURIComponent(m.jobId)}/cancel`,
    },
    // Enrich-then-Analyze orchestrator — one button, two phases. Body shape:
    //   { kind: "companies"|"contacts", ids: number[], waitMs?, force?, skipEnrich? }
    "crm-enrich-then-analyze": {
      method: "POST",
      path: () => `/api/crm/enrich-then-analyze`,
      body: (m) => m.body,
    },
    "crm-enrich-then-analyze-get": {
      method: "GET",
      path: (m) => `/api/crm/enrich-then-analyze/${encodeURIComponent(m.jobId)}`,
    },
    "crm-enrich-then-analyze-cancel": {
      method: "POST",
      path: (m) => `/api/crm/enrich-then-analyze/${encodeURIComponent(m.jobId)}/cancel`,
    },

    // ICP scoring (throxy three-gate + empirical ensemble)
    "icp-config-get": { method: "GET", path: () => `/api/icp/config` },
    "icp-config-save": { method: "PUT", path: () => `/api/icp/config`, body: (m) => m.body },
    "icp-score-one": { method: "POST", path: () => `/api/icp/score-one`, body: (m) => m.body },
    "icp-companies-list": {
      method: "GET",
      path: (m) => `/api/icp/companies${m.queryString || ""}`,
    },
    "icp-rescore-all": { method: "POST", path: () => `/api/icp/rescore-all` },
    "icp-status": { method: "GET", path: () => `/api/icp/status` },
    "icp-company-signals": {
      method: "POST",
      path: (m) => `/api/icp/companies/${encodeURIComponent(m.companyId)}/signals`,
      body: (m) => m.body,
    },
    "icp-scrape-next": {
      method: "GET",
      path: (m) => `/api/icp/scrape-queue/next?url=${encodeURIComponent(m.url || "")}`,
    },
    "icp-scrape-result": {
      method: "POST",
      path: (m) => `/api/icp/scrape-queue/${encodeURIComponent(m.taskId)}/result`,
      body: (m) => m.body,
    },
    "icp-auto-config": { method: "POST", path: () => `/api/icp/auto-config`, body: (m) => m.body },
    "icp-services-get": { method: "GET", path: () => `/api/icp/services` },
    "icp-services-save": { method: "PUT", path: () => `/api/icp/services`, body: (m) => m.body },
    "icp-filters-get": { method: "GET", path: () => `/api/icp/filters` },
    "icp-filters-save": { method: "PUT", path: () => `/api/icp/filters`, body: (m) => m.body },
    "icp-filters-generate": {
      method: "POST",
      path: () => `/api/icp/filters/generate`,
      body: (m) => m.body,
    },
    "icp-score-one-ai": {
      method: "POST",
      path: () => `/api/icp/score-one-ai`,
      body: (m) => m.body,
    },

    "crm-contact-detail": {
      method: "GET",
      path: (m) => `/api/crm/contacts/${encodeURIComponent(m.contactId)}`,
    },
    "crm-contact-timeline": {
      method: "GET",
      path: (m) => `/api/crm/contacts/${encodeURIComponent(m.contactId)}/timeline`,
    },
    "crm-suggested-follow-ups": { method: "GET", path: () => `/api/crm/suggested-follow-ups` },
    // Basic mode — Objective Search funnel (URL -> research -> ranked suggestions -> activate)
    "search-start": { method: "POST", path: () => `/api/search`, body: (m) => m.body },
    "search-poll": { method: "GET", path: (m) => `/api/search/${encodeURIComponent(m.slug)}` },
    "search-select": {
      method: "POST",
      path: (m) => `/api/search/${encodeURIComponent(m.slug)}/select`,
      body: (m) => m.body,
    },
    "search-activation-plan": {
      method: "GET",
      path: (m) => `/api/search/${encodeURIComponent(m.slug)}/activation-plan`,
    },
    "search-activate": {
      method: "POST",
      path: (m) => `/api/search/${encodeURIComponent(m.slug)}/activate`,
      body: (m) => m.body,
    },
    "search-launch": {
      method: "POST",
      path: (m) => `/api/search/${encodeURIComponent(m.slug)}/launch`,
      body: (m) => m.body,
    },
    "crm-contact-update": {
      method: "POST",
      path: (m) => `/api/crm/contacts/${encodeURIComponent(m.contactId)}/update`,
      body: (m) => m.body,
    },
    "company-console": {
      method: "GET",
      path: (m) => `/api/company/${encodeURIComponent(m.companyId)}/console`,
    },
    "company-create-campaign": {
      method: "POST",
      path: (m) => `/api/company/${encodeURIComponent(m.companyId)}/campaign`,
      body: (m) => m.body,
    },
    "company-update-campaign": {
      method: "POST",
      path: (m) =>
        `/api/company/${encodeURIComponent(m.companyId)}/campaign/${encodeURIComponent(m.campaignId)}`,
      body: (m) => m.body,
    },
    "company-publish": {
      method: "POST",
      path: (m) => `/api/company/${encodeURIComponent(m.companyId)}/publish`,
      body: (m) => m.body || {},
    },
    "conversation-plays": { method: "GET", path: () => `/api/conversation-plays` },
    "conversation-play-create": {
      method: "POST",
      path: () => `/api/conversation-plays`,
      body: (m) => m.body,
    },
    "conversation-play-get": {
      method: "GET",
      path: (m) => `/api/conversation-plays/${encodeURIComponent(m.id)}`,
    },
    "conversation-play-update": {
      method: "POST",
      path: (m) => `/api/conversation-plays/${encodeURIComponent(m.id)}`,
      body: (m) => m.body,
    },
    "conversation-play-status": {
      method: "POST",
      path: (m) => `/api/conversation-plays/${encodeURIComponent(m.id)}/status`,
      body: (m) => m.body,
    },
    "conversation-play-delete": {
      method: "DELETE",
      path: (m) => `/api/conversation-plays/${encodeURIComponent(m.id)}`,
    },
    "conversation-play-preview": {
      method: "POST",
      path: (m) => `/api/conversation-plays/${encodeURIComponent(m.id)}/preview`,
      body: (m) => m.body,
    },
    "crm-company-contacts": {
      method: "GET",
      path: (m) => `/api/crm/companies/${encodeURIComponent(m.companyId)}/contacts`,
    },
    "crm-contacts-tags": { method: "GET", path: () => `/api/crm/contacts/tags` },
    "crm-bulk-campaign": {
      method: "POST",
      path: () => `/api/crm/contacts/bulk-campaign`,
      body: (m) => m.body,
    },
    "crm-contacts-sectors": { method: "GET", path: () => `/api/crm/contacts/sectors` },
    "crm-activity": { method: "GET", path: () => `/api/crm/activity` },
    "crm-inbox": { method: "GET", path: (m) => `/api/crm/inbox${m.queryString || ""}` },
    "crm-inbox-handled": {
      method: "POST",
      path: () => `/api/crm/inbox/handled`,
      body: (m) => m.body,
    },
    "crm-deals": { method: "GET", path: (m) => `/api/crm/deals${m.queryString || ""}` },
    "crm-deals-update": {
      method: "POST",
      path: () => `/api/crm/deals/update`,
      body: (m) => m.body,
    },
    "crm-deals-create": {
      method: "POST",
      path: () => `/api/crm/deals/create`,
      body: (m) => m.body,
    },
    // Event promotion campaigns (v60)
    "evc-list": { method: "GET", path: () => `/api/crm/event-campaigns` },
    "evc-create": { method: "POST", path: () => `/api/crm/event-campaigns`, body: (m) => m.body },
    "evc-detail": {
      method: "GET",
      path: (m) => `/api/crm/event-campaigns/${encodeURIComponent(m.id)}${m.queryString || ""}`,
    },
    "evc-tg-groups": {
      method: "POST",
      path: (m) => `/api/crm/event-campaigns/${encodeURIComponent(m.id)}/tg-groups`,
      body: (m) => m.body,
    },
    "evc-start": {
      method: "POST",
      path: (m) => `/api/crm/event-campaigns/${encodeURIComponent(m.id)}/start`,
    },
    "evc-pause": {
      method: "POST",
      path: (m) => `/api/crm/event-campaigns/${encodeURIComponent(m.id)}/pause`,
    },
    "evc-stop": {
      method: "POST",
      path: (m) => `/api/crm/event-campaigns/${encodeURIComponent(m.id)}/stop`,
    },
    "evc-approve": {
      method: "POST",
      path: () => `/api/crm/event-campaigns/audience/approve`,
      body: (m) => m.body,
    },
    "evc-skip": {
      method: "POST",
      path: () => `/api/crm/event-campaigns/audience/skip`,
      body: (m) => m.body,
    },
    "evc-edit": {
      method: "POST",
      path: () => `/api/crm/event-campaigns/audience/edit`,
      body: (m) => m.body,
    },
    // LinkedIn comment-drafts approval queue (crypto_hiring_outreach)
    "lic-list": { method: "GET", path: (m) => `/api/crm/comment-drafts${m.queryString || ""}` },
    "lic-approve": {
      method: "POST",
      path: () => `/api/crm/comment-drafts/approve`,
      body: (m) => m.body,
    },
    "lic-skip": { method: "POST", path: () => `/api/crm/comment-drafts/skip`, body: (m) => m.body },
    "lic-edit": { method: "POST", path: () => `/api/crm/comment-drafts/edit`, body: (m) => m.body },
    // Group-reply drafts approval queue (transparent authentic-tier replies)
    "grd-list": { method: "GET", path: (m) => `/api/group-reply-drafts${m.queryString || ""}` },
    "grd-approve": {
      method: "POST",
      path: () => `/api/group-reply-drafts/approve`,
      body: (m) => m.body,
    },
    "grd-skip": { method: "POST", path: () => `/api/group-reply-drafts/skip`, body: (m) => m.body },
    "grd-edit": { method: "POST", path: () => `/api/group-reply-drafts/edit`, body: (m) => m.body },
    "live-map": { method: "GET", path: () => `/api/admin/live-map` },
    "automations-proof": { method: "GET", path: () => `/api/admin/automations/proof` },
    "ai-briefing": { method: "GET", path: () => `/api/admin/ai-briefing` },
    "ai-briefing-refresh": { method: "POST", path: () => `/api/admin/ai-briefing/refresh` },
    "emergency-stop": { method: "POST", path: () => `/api/admin/emergency-stop` },
    "account-control": {
      method: "POST",
      path: (m) =>
        `/api/accounts/${encodeURIComponent(m.platform)}/${encodeURIComponent(m.accountId)}/control`,
      body: (m) => m.body,
    },
    "account-session-remove": {
      method: "POST",
      path: (m) => `/api/accounts/${encodeURIComponent(m.platform)}/session-remove`,
      body: (m) => m.body,
    },
    "proxies-list": { method: "GET", path: () => `/api/proxies` },
    "proxy-add": { method: "POST", path: () => `/api/proxies`, body: (m) => m.body || {} },
    "job-control": {
      method: "POST",
      path: (m) => `/api/admin/jobs/${encodeURIComponent(m.jobName)}/control`,
      body: (m) => m.body,
    },
    "crm-contacts-create": {
      method: "POST",
      path: () => `/api/crm/contacts/create`,
      body: (m) => m.body,
    },
    "crm-companies-create": {
      method: "POST",
      path: () => `/api/crm/companies/create`,
      body: (m) => m.body,
    },
    "crm-company-update": {
      method: "POST",
      path: (m) => `/api/crm/companies/${encodeURIComponent(m.companyId)}/update`,
      body: (m) => m.body,
    },
    "crm-pipeline": { method: "GET", path: () => `/api/crm/pipeline` },
    "crm-connection-requests": { method: "GET", path: () => `/api/crm/connection-requests` },
    "connect-account": { method: "POST", path: () => `/api/connect`, body: (m) => m.body },

    // Telegram features (dashboard-native)
    "tg-autoreply-list": { method: "GET", path: () => `/api/telegram/autoreply` },
    "tg-autoreply-save": {
      method: "POST",
      path: () => `/api/telegram/autoreply`,
      body: (m) => m.body,
    },
    "tg-autoreply-toggle": {
      method: "POST",
      path: () => `/api/telegram/autoreply/toggle`,
      body: (m) => m.body,
    },
    "tg-broadcast-history": { method: "GET", path: () => `/api/telegram/broadcast/history` },
    "tg-broadcast-send": {
      method: "POST",
      path: () => `/api/telegram/broadcast/send`,
      body: (m) => m.body,
    },
    "tg-invite-list": { method: "GET", path: () => `/api/telegram/invite/list` },
    "tg-invite-create": {
      method: "POST",
      path: () => `/api/telegram/invite/create`,
      body: (m) => m.body,
    },
    "tg-invite-stop": { method: "POST", path: (m) => `/api/telegram/invite/${m.jobId}/stop` },
    "tg-forward-list": { method: "GET", path: () => `/api/telegram/forward/list` },
    "tg-forward-create": {
      method: "POST",
      path: () => `/api/telegram/forward/create`,
      body: (m) => m.body,
    },
    "tg-forward-toggle": {
      method: "POST",
      path: (m) => `/api/telegram/forward/${m.ruleId}/toggle`,
      body: (m) => m.body,
    },
    "tg-forward-delete": {
      method: "POST",
      path: (m) => `/api/telegram/forward/${m.ruleId}/delete`,
    },
    "tg-activemember-list": { method: "GET", path: () => `/api/telegram/activemember/list` },
    "tg-activemember-create": {
      method: "POST",
      path: () => `/api/telegram/activemember/create`,
      body: (m) => m.body,
    },
    "tg-activemember-toggle": {
      method: "POST",
      path: (m) => `/api/telegram/activemember/${m.configId}/toggle`,
      body: (m) => m.body,
    },
    "tg-activemember-delete": {
      method: "POST",
      path: (m) => `/api/telegram/activemember/${m.configId}/delete`,
    },
    "tg-activemember-log": {
      method: "GET",
      path: (m) => `/api/telegram/activemember/${m.configId}/log`,
    },
    "tg-passive-groups": { method: "GET", path: () => `/api/telegram/passive/groups` },
    "tg-passive-add": {
      method: "POST",
      path: () => `/api/telegram/passive/add`,
      body: (m) => m.body,
    },
    "tg-passive-remove": {
      method: "POST",
      path: () => `/api/telegram/passive/remove`,
      body: (m) => m.body,
    },
    "tg-stories-get": { method: "GET", path: () => `/api/telegram/stories` },
    "tg-stories-config": {
      method: "POST",
      path: () => `/api/telegram/stories/config`,
      body: (m) => m.body,
    },
    "tg-stories-toggle": {
      method: "POST",
      path: () => `/api/telegram/stories/toggle`,
      body: (m) => m.body,
    },
    "tg-groups": { method: "GET", path: () => `/api/telegram/groups` },
    "luma-subs": { method: "GET", path: () => `/api/luma/subscriptions` },
    "luma-sub-create": {
      method: "POST",
      path: () => `/api/luma/subscriptions/create`,
      body: (m) => m.body,
    },
    "luma-sub-delete": { method: "POST", path: (m) => `/api/luma/subscriptions/${m.subId}/delete` },

    // Inbox, Mission Control, Email Sequences/Warmup, Scan, Import
    "inbox-replies": { method: "GET", path: () => `/api/inbox/replies` },
    "mission-control": { method: "GET", path: () => `/api/mission-control` },
    "email-sequences-list": { method: "GET", path: () => `/api/email/sequences` },
    "email-sequences-create": {
      method: "POST",
      path: () => `/api/email/sequences/create`,
      body: (m) => m.body,
    },
    "email-sequences-toggle": {
      method: "POST",
      path: (m) => `/api/email/sequences/${m.seqId}/toggle`,
      body: (m) => m.body,
    },
    "email-warmup-list": { method: "GET", path: () => `/api/email/warmup` },
    "email-warmup-start": {
      method: "POST",
      path: () => `/api/email/warmup/start`,
      body: (m) => m.body,
    },
    "email-warmup-stop": {
      method: "POST",
      path: () => `/api/email/warmup/stop`,
      body: (m) => m.body,
    },
    "scan-url": { method: "POST", path: () => `/api/scan`, body: (m) => m.body },
    "import-preview": {
      method: "POST",
      path: () => `/api/crm/import/preview`,
      body: (m) => m.body,
    },
    "import-execute": {
      method: "POST",
      path: () => `/api/crm/import/execute`,
      body: (m) => m.body,
    },

    // Visual workflow builder (preset DAGs from src/workflow/presets/*.json)
    "automations-list": { method: "GET", path: () => `/api/workflows` },
    "automation-detail": {
      method: "GET",
      path: (m) => `/api/workflows/${encodeURIComponent(m.id)}`,
    },
    "automation-detail-custom": {
      method: "GET",
      path: (m) => `/api/workflows/custom/${encodeURIComponent(m.customId)}`,
    },
    "automations-registry": { method: "GET", path: () => `/api/workflows/registry` },
    "automation-clone": { method: "POST", path: () => `/api/workflows/clone`, body: (m) => m.body },
    "automation-update-custom": {
      method: "PATCH",
      path: (m) => `/api/workflows/custom/${encodeURIComponent(m.customId)}`,
      body: (m) => m.body,
    },
    "automation-archive-custom": {
      method: "POST",
      path: (m) => `/api/workflows/custom/${encodeURIComponent(m.customId)}/archive`,
    },
    "automation-run-now": {
      method: "POST",
      path: (m) => `/api/workflows/custom/${encodeURIComponent(m.customId)}/run-now`,
    },
    "automations-runs-summary": {
      method: "GET",
      path: (m) => `/api/workflows/runs/summary?days=${encodeURIComponent(m.days || 1)}`,
    },

    // Campaign workflows + group campaigns
    "workflows-list": { method: "GET", path: () => `/api/campaigns/workflows` },
    "workflow-create": {
      method: "POST",
      path: () => `/api/campaigns/workflows/create`,
      body: (m) => m.body,
    },
    "workflow-toggle": {
      method: "POST",
      path: (m) => `/api/campaigns/workflows/${m.workflowId}/toggle`,
      body: (m) => m.body,
    },
    "workflow-delete": {
      method: "POST",
      path: (m) => `/api/campaigns/workflows/${m.workflowId}/delete`,
    },
    "workflow-control": {
      method: "GET",
      path: (m) => `/api/campaigns/workflows/${m.workflowId}/control`,
    },
    "workflow-run-now": {
      method: "POST",
      path: (m) => `/api/campaigns/workflows/${m.workflowId}/run-now`,
    },
    "group-campaigns-list": { method: "GET", path: () => `/api/campaigns/groups` },
    "group-campaign-create": {
      method: "POST",
      path: () => `/api/campaigns/groups/create`,
      body: (m) => m.body,
    },
    "signals-search": { method: "POST", path: () => `/api/signals/search`, body: (m) => m.body },
    "activity-live": { method: "GET", path: (m) => `/api/activity/live${m.queryString || ""}` },
    "dashboard-running": { method: "GET", path: () => `/api/dashboard/running` },
    "account-stats": {
      method: "GET",
      path: (m) => `/api/accounts/stats?platform=${m.platform}&id=${m.id}`,
    },
    "admin-health": { method: "GET", path: () => `/api/admin/health` },

    // Settings: AI keys + preferences (Phase 1)
    "settings-api-keys-list": { method: "GET", path: () => `/api/settings/api-keys` },
    "settings-api-keys-save": {
      method: "POST",
      path: () => `/api/settings/api-keys`,
      body: (m) => m.body,
    },
    "settings-api-keys-delete": {
      method: "DELETE",
      path: (m) => `/api/settings/api-keys/${encodeURIComponent(m.provider)}`,
    },
    "settings-preferences-get": { method: "GET", path: () => `/api/settings/preferences` },
    "settings-preferences-save": {
      method: "POST",
      path: () => `/api/settings/preferences`,
      body: (m) => m.body,
    },

    // Premium status (read-only)
    "premium-status": { method: "GET", path: () => `/api/premium/status` },

    // Home dashboard payload (existing endpoint, exposed for new renderHome)
    "dashboard-home": { method: "GET", path: () => `/api/dashboard/home` },

    // People Workspace (Phase 2)
    "people-counts": { method: "GET", path: () => `/api/people/counts` },
    "people-recommended": {
      method: "GET",
      path: (m) => `/api/people/recommended${m.queryString || ""}`,
    },
    "people-requests": { method: "GET", path: () => `/api/people/requests` },
    "people-sent": { method: "GET", path: (m) => `/api/people/sent${m.queryString || ""}` },
    "people-connections": {
      method: "GET",
      path: (m) => `/api/people/connections${m.queryString || ""}`,
    },
    "people-detail": {
      method: "GET",
      path: (m) => `/api/people/${encodeURIComponent(m.profileId)}`,
    },
    "people-connect": {
      method: "POST",
      path: (m) => `/api/people/${encodeURIComponent(m.profileId)}/connect`,
      body: (m) => m.body || {},
    },
    "people-pass": {
      method: "POST",
      path: (m) => `/api/people/${encodeURIComponent(m.profileId)}/pass`,
    },
    "people-block": {
      method: "POST",
      path: (m) => `/api/people/${encodeURIComponent(m.profileId)}/block`,
    },
    "people-bookmark-add": {
      method: "POST",
      path: (m) => `/api/people/${encodeURIComponent(m.profileId)}/bookmark`,
    },
    "people-bookmark-remove": {
      method: "DELETE",
      path: (m) => `/api/people/${encodeURIComponent(m.profileId)}/bookmark`,
    },
    "people-request-accept": {
      method: "POST",
      path: (m) => `/api/people/requests/${encodeURIComponent(m.requestId)}/accept`,
    },
    "people-request-decline": {
      method: "POST",
      path: (m) => `/api/people/requests/${encodeURIComponent(m.requestId)}/decline`,
    },

    // CRM Google Sheets (Phase 3)
    "crm-sheets-status": { method: "GET", path: () => `/api/crm/sheets/status` },
    "crm-sheets-create": {
      method: "POST",
      path: () => `/api/crm/sheets/create`,
      body: (m) => m.body || {},
    },
    "crm-sheets-connect": {
      method: "POST",
      path: () => `/api/crm/sheets/connect`,
      body: (m) => m.body || {},
    },
    "crm-sheets-sync": { method: "POST", path: () => `/api/crm/sheets/sync` },

    // Competitor Intel (Phase 5)
    "competitors-list": { method: "GET", path: () => `/api/competitors` },
    "competitors-add": {
      method: "POST",
      path: () => `/api/competitors`,
      body: (m) => m.body || {},
    },
    "competitors-scan-all": { method: "POST", path: () => `/api/competitors/scan-all` },
    "competitor-detail": {
      method: "GET",
      path: (m) => `/api/competitors/${encodeURIComponent(m.id)}`,
    },
    "competitor-scan": {
      method: "POST",
      path: (m) => `/api/competitors/${encodeURIComponent(m.id)}/scan`,
    },
    "competitor-archive": {
      method: "POST",
      path: (m) => `/api/competitors/${encodeURIComponent(m.id)}/archive`,
    },
    "competitor-routine-add": {
      method: "POST",
      path: (m) => `/api/competitors/${encodeURIComponent(m.id)}/routines`,
      body: (m) => m.body || {},
    },
    "competitor-routine-toggle": {
      method: "POST",
      path: (m) => `/api/competitors/routines/${encodeURIComponent(m.routineId)}/toggle`,
      body: (m) => m.body || {},
    },

    // AI Service Match (Phase 5)
    "service-match-profile-get": { method: "GET", path: () => `/api/service-match/profile` },
    "service-match-profile-save": {
      method: "POST",
      path: () => `/api/service-match/profile`,
      body: (m) => m.body || {},
    },
    "service-match-analyze": {
      method: "POST",
      path: () => `/api/service-match/analyze`,
      body: (m) => m.body || {},
    },
    "service-match-companies": {
      method: "GET",
      path: (m) => `/api/service-match/companies${m.queryString || ""}`,
    },
    "service-match-network": {
      method: "GET",
      path: (m) => `/api/service-match/network/${encodeURIComponent(m.companyId)}`,
    },
    "service-match-plan-create": {
      method: "POST",
      path: () => `/api/service-match/plan`,
      body: (m) => m.body || {},
    },
    "service-match-plan-pending": { method: "GET", path: () => `/api/service-match/plan` },
    "service-match-performance": { method: "GET", path: () => `/api/service-match/performance` },
    "service-match-plan-item-approve": {
      method: "POST",
      path: (m) => `/api/service-match/plan/items/${encodeURIComponent(m.itemId)}/approve`,
    },
    "service-match-plan-item-skip": {
      method: "POST",
      path: (m) => `/api/service-match/plan/items/${encodeURIComponent(m.itemId)}/skip`,
    },
    "service-match-plan-execute": {
      method: "POST",
      path: (m) => `/api/service-match/plan/${encodeURIComponent(m.planId)}/execute`,
    },
    "service-match-company-execute": {
      method: "POST",
      path: (m) => `/api/service-match/companies/${encodeURIComponent(m.companyId)}/execute`,
      body: (m) => m.body || {},
    },

    // Your Profile (Phase 6)
    "profile-get": { method: "GET", path: () => `/api/profile` },
    "profile-update": { method: "POST", path: () => `/api/profile`, body: (m) => m.body || {} },
    "profile-delete": { method: "DELETE", path: () => `/api/profile` },

    // Bookmarks (per-user CRM/profile/company/opportunity starring)
    "bookmarks-list": { method: "GET", path: (m) => `/api/bookmarks${m.queryString || ""}` },
    "bookmarks-counts": { method: "GET", path: () => `/api/bookmarks/counts` },
    "bookmark-add": {
      method: "POST",
      path: (m) => `/api/bookmarks/${encodeURIComponent(m.type)}/${encodeURIComponent(m.id)}`,
    },
    "bookmark-remove": {
      method: "DELETE",
      path: (m) => `/api/bookmarks/${encodeURIComponent(m.type)}/${encodeURIComponent(m.id)}`,
    },

    // Operations cockpit — what's running right now + per-instance control.
    // ops-live aggregates customs + loops + recent system crons (per-user).
    // ops-system-jobs is the global registry of all named cron jobs.
    // ops-loop-action toggles individual long-running loops by (type, id).
    "ops-live": { method: "GET", path: () => `/api/ops/live` },
    "ops-system-jobs": { method: "GET", path: () => `/api/ops/system-jobs` },
    "ops-loop-action": {
      method: "POST",
      path: (m) =>
        `/api/ops/loops/${encodeURIComponent(m.type)}/${encodeURIComponent(m.id)}/${encodeURIComponent(m.action)}`,
    },
    "ops-job-trigger": {
      method: "POST",
      path: (m) => `/api/ops/system-jobs/${encodeURIComponent(m.name)}/trigger`,
    },
    "ops-run-verify": {
      method: "POST",
      path: (m) => `/api/ops/runs/${encodeURIComponent(m.runId)}/verify`,
      body: (m) => m.body,
    },
    "ops-coverage": { method: "GET", path: () => `/api/ops/coverage` },
    // Outcome metrics (conversion funnel + per-account scoreboard)
    "ops-outcomes": { method: "GET", path: (m) => `/api/ops/outcomes${m.queryString || ""}` },
    "ops-account-scoreboard": {
      method: "GET",
      path: (m) => `/api/ops/account-scoreboard${m.queryString || ""}`,
    },

    // Always-on service toggles (per-user enable/disable for cron engines)
    "services-toggles": { method: "GET", path: () => `/api/services/toggles` },
    "service-toggle-set": {
      method: "PATCH",
      path: () => `/api/services/toggles`,
      body: (m) => m.body,
    },

    // Per-run output drill-down (signals + outreach events the run produced)
    "automation-run-outputs": {
      method: "GET",
      path: (m) => `/api/automations/runs/${encodeURIComponent(m.runId)}/outputs`,
    },

    // Account lockout recovery — clears lockout_state after the user has
    // solved a captcha / re-logged-in / etc. on the platform itself.
    "social-account-unlock": {
      method: "POST",
      path: (m) => `/api/social-accounts/${encodeURIComponent(m.accountId)}/unlock`,
    },
    "social-account-pause": {
      method: "POST",
      path: (m) => `/api/social-accounts/${encodeURIComponent(m.accountId)}/pause`,
      body: (m) => m.body || {},
    },

    // AI reply generation (humanized, voice-aware) — used by extension
    // panel + signal engagement to replace hardcoded canned replies.
    "ai-reply": { method: "POST", path: () => `/api/ai/reply`, body: (m) => m.body },

    // Voice profile management for AI reply humanization.
    "voice-profile-get": {
      method: "GET",
      path: (m) => `/api/social-accounts/${encodeURIComponent(m.accountId)}/voice-profile`,
    },
    "voice-profile-set": {
      method: "PUT",
      path: (m) => `/api/social-accounts/${encodeURIComponent(m.accountId)}/voice-profile`,
      body: (m) => m.body,
    },
    "voice-profile-refresh": {
      method: "POST",
      path: (m) => `/api/social-accounts/${encodeURIComponent(m.accountId)}/voice-profile/refresh`,
    },
    "voice-presets-list": { method: "GET", path: () => `/api/voice-presets` },
    "voice-profile-apply-preset": {
      method: "POST",
      path: (m) => `/api/social-accounts/${encodeURIComponent(m.accountId)}/voice-profile/preset`,
      body: (m) => m.body,
    },
    // Phase 3: mimic another account's voice
    "voice-profile-mimic": {
      method: "POST",
      path: (m) => `/api/social-accounts/${encodeURIComponent(m.accountId)}/voice-profile/mimic`,
      body: (m) => m.body,
    },
    // Phase 4: A/B telemetry — log sent replies + read aggregate stats
    "ai-reply-log": { method: "POST", path: () => `/api/ai/reply-log`, body: (m) => m.body },
    "voice-profile-stats": {
      method: "GET",
      path: (m) => `/api/social-accounts/${encodeURIComponent(m.accountId)}/voice-profile/stats`,
    },

    // Telegram: join group by invite link (Active Member modal)
    "tg-join-by-invite": {
      method: "POST",
      path: () => `/api/telegram/groups/join-by-invite`,
      body: (m) => m.body,
    },

    // Workflow Compositions (WHO × WHERE × WHAT composer)
    "compositions-list": { method: "GET", path: (m) => `/api/compositions${m.queryString || ""}` },
    "composition-get": {
      method: "GET",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}`,
    },
    "composition-create": { method: "POST", path: () => `/api/compositions`, body: (m) => m.body },
    "composition-update": {
      method: "PATCH",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}`,
      body: (m) => m.body,
    },
    "composition-delete": {
      method: "DELETE",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}`,
    },
    "composition-activate": {
      method: "POST",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/activate`,
    },
    "composition-pause": {
      method: "POST",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/pause`,
    },
    "composition-archive": {
      method: "POST",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/archive`,
    },
    "composition-killswitch": {
      method: "POST",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/killswitch`,
    },
    "composition-account-budgets": {
      method: "GET",
      path: () => `/api/compositions/account-budgets`,
    },
    "composition-operator-summary": {
      method: "GET",
      path: () => `/api/compositions/operator-summary`,
    },
    "composition-clone": {
      method: "POST",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/clone`,
      body: (m) => m.body || {},
    },
    "composition-compare": {
      method: "GET",
      path: (m) => `/api/compositions/compare?ids=${encodeURIComponent((m.ids || []).join(","))}`,
    },
    "composition-run": {
      method: "POST",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/run`,
      body: (m) => m.body || {},
    },
    "composition-preview": {
      method: "POST",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/preview`,
    },
    "composition-audience-count": {
      method: "POST",
      path: () => `/api/compositions/audience-count`,
      body: (m) => m.body,
    },
    "composition-source-catalog": { method: "GET", path: () => `/api/compositions/source-catalog` },
    "composition-play-catalog": { method: "GET", path: () => `/api/compositions/play-catalog` },
    "composition-event-sources": { method: "GET", path: () => `/api/compositions/event-sources` },
    "composition-cron-preview": {
      method: "GET",
      path: (m) =>
        `/api/compositions/cron-preview?expr=${encodeURIComponent(m.expr)}&n=${m.n || 3}`,
    },
    "composition-templates": {
      method: "GET",
      path: (m) =>
        `/api/compositions/templates${m?.includeDeprecated ? "?include_deprecated=true" : ""}`,
    },
    "composition-from-template": {
      method: "POST",
      path: (m) => `/api/compositions/from-template/${encodeURIComponent(m.templateId)}`,
      body: (m) => m.body || {},
    },
    // Phase 31e + 32: voice catalog + performance dashboards
    "composition-voice-catalog": { method: "GET", path: () => `/api/compositions/voice-catalog` },
    "composition-performance-templates": {
      method: "GET",
      path: () => `/api/compositions/performance/templates`,
    },
    "composition-performance-tracks": {
      method: "GET",
      path: () => `/api/compositions/performance/tracks`,
    },
    "composition-performance-accounts": {
      method: "GET",
      path: () => `/api/compositions/performance/accounts`,
    },
    "composition-performance-cost": {
      method: "GET",
      path: () => `/api/compositions/performance/cost-per-reply`,
    },
    "composition-save-as-template": {
      method: "POST",
      path: () => `/api/compositions/save-as-template`,
      body: (m) => m.body,
    },
    "composition-delete-user-template": {
      method: "DELETE",
      path: (m) => `/api/compositions/user-templates/${encodeURIComponent(m.id)}`,
    },
    "composition-runs": {
      method: "GET",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/runs?limit=${m.limit || 20}`,
    },
    "composition-funnel": {
      method: "GET",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/funnel`,
    },
    "composition-variants": {
      method: "GET",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/variants`,
    },
    "composition-run-audit": {
      method: "GET",
      path: (m) => `/api/compositions/runs/${encodeURIComponent(m.runId)}/audit`,
    },
    "composition-run-play-status": {
      method: "GET",
      path: (m) => `/api/compositions/runs/${encodeURIComponent(m.runId)}/play-status`,
    },
    "composition-suggestions": {
      method: "POST",
      path: (m) => `/api/compositions/${encodeURIComponent(m.id)}/suggestions`,
      body: () => ({}),
    },
    // Phase ZA — Composer health check (live diagnostic UI)
    "composer-health-check-start": {
      method: "POST",
      path: () => `/api/composer/health-check`,
      body: () => ({}),
    },
    "composer-health-check-status": {
      method: "GET",
      path: (m) => `/api/composer/health-check/${encodeURIComponent(m.runId)}`,
    },
    // Phase ZB — Test-all-compositions (sequential per-composition dry-run with live log)
    "composer-test-all-start": {
      method: "POST",
      path: () => `/api/composer/test-all-compositions`,
      body: (m) => m.body || {},
    },
    "composer-test-all-status": {
      method: "GET",
      path: (m) => `/api/composer/test-all-compositions/${encodeURIComponent(m.runId)}`,
    },
    "composer-test-all-cancel": {
      method: "DELETE",
      path: (m) => `/api/composer/test-all-compositions/${encodeURIComponent(m.runId)}`,
    },
    // Phase ZF — Test-live-one (REAL execution of one template/composition on 1 contact, watch the browser do it)
    "composer-test-live-one": {
      method: "POST",
      path: () => `/api/composer/test-live-one`,
      body: (m) => m.body || {},
    },
    // Phase ZD — Sales proposals
    "proposals-list": { method: "GET", path: (m) => `/api/proposals${m.queryString || ""}` },
    "proposals-get": { method: "GET", path: (m) => `/api/proposals/${encodeURIComponent(m.id)}` },
    "proposals-update": {
      method: "PATCH",
      path: (m) => `/api/proposals/${encodeURIComponent(m.id)}`,
      body: (m) => m.body,
    },
    "proposals-revoke": {
      method: "DELETE",
      path: (m) => `/api/proposals/${encodeURIComponent(m.id)}`,
    },
    "proposals-views": {
      method: "GET",
      path: (m) => `/api/proposals/${encodeURIComponent(m.id)}/views`,
    },
    "proposals-templates": { method: "GET", path: () => `/api/proposals/templates` },
    "composition-contact-audit": {
      method: "GET",
      path: (m) => `/api/compositions/contacts/${encodeURIComponent(m.contactId)}/audit`,
    },
    "composition-resolve-one": {
      method: "POST",
      path: () => `/api/compositions/audience-resolve-one`,
      body: (m) => m.body,
    },

    // Outreach orchestrator queue
    "outreach-queue": { method: "GET", path: (m) => `/api/outreach/queue${m.queryString || ""}` },
    "outreach-channel-retry": {
      method: "POST",
      path: (m) =>
        `/api/outreach/campaigns/${encodeURIComponent(m.campaignId)}/channels/${encodeURIComponent(m.channel)}/retry`,
    },
    "outreach-channel-cancel": {
      method: "POST",
      path: (m) =>
        `/api/outreach/campaigns/${encodeURIComponent(m.campaignId)}/channels/${encodeURIComponent(m.channel)}/cancel`,
    },
    "outreach-cancel-all": {
      method: "POST",
      path: (m) => `/api/outreach/campaigns/${encodeURIComponent(m.campaignId)}/cancel-all`,
    },
    "outreach-resume": {
      method: "POST",
      path: (m) => `/api/outreach/campaigns/${encodeURIComponent(m.campaignId)}/resume`,
    },

    // Health + DNC
    "health-accounts": { method: "GET", path: () => `/api/health/accounts` },
    "coinmm-status": { method: "GET", path: () => `/api/coinmm/status` },
    "run-preview": { method: "POST", path: () => `/api/run/preview`, body: (m) => m.body || {} },
    "run-previews": { method: "GET", path: () => `/api/run/previews` },
    "run-preview-get": {
      method: "GET",
      path: (m) => `/api/run/previews/${encodeURIComponent(m.id)}`,
    },
    "run-preview-confirm": {
      method: "POST",
      path: (m) => `/api/run/previews/${encodeURIComponent(m.previewId)}/confirm`,
      body: () => ({}),
    },

    // In-extension notification center (the bell)
    "notifications-list": {
      method: "GET",
      path: (m) => `/api/notifications${m.queryString || ""}`,
    },
    "notification-read": {
      method: "POST",
      path: (m) => `/api/notifications/${encodeURIComponent(m.id)}/read`,
      body: () => ({}),
    },
    "notifications-read-all": {
      method: "POST",
      path: (m) => `/api/notifications/read-all${m.queryString || ""}`,
      body: () => ({}),
    },

    // Capabilities + Telegram add-on linking
    capabilities: { method: "GET", path: () => `/api/capabilities` },
    "telegram-link": {
      method: "POST",
      path: () => `/api/telegram/link`,
      body: (m) => m.body || {},
    },

    // Workspaces (multi-tenant / agency layer)
    "workspaces-list": { method: "GET", path: () => `/api/workspaces` },
    "workspace-create": {
      method: "POST",
      path: () => `/api/workspaces`,
      body: (m) => ({ name: m.name, brand: m.brand || null }),
    },
    "workspace-brand-get": {
      method: "GET",
      path: (m) => `/api/workspaces/${encodeURIComponent(m.id)}/brand`,
    },
    "workspace-brand-set": {
      method: "PUT",
      path: (m) => `/api/workspaces/${encodeURIComponent(m.id)}/brand`,
      body: (m) => ({ brand: m.brand || {} }),
    },
    "agency-overview": { method: "GET", path: (m) => `/api/agency/overview${m.queryString || ""}` },
    "dnc-suggestions": { method: "GET", path: () => `/api/health/dnc-suggestions` },
    "dnc-list": { method: "GET", path: (m) => `/api/contacts/dnc${m.queryString || ""}` },
    "contact-dnc-toggle": {
      method: "POST",
      path: (m) => `/api/contacts/${encodeURIComponent(m.contactId)}/dnc`,
      body: (m) => m.body || {},
    },

    // Inbox reply (in-extension X / LinkedIn / Email reply)
    "inbox-reply": {
      method: "POST",
      path: (m) => `/api/inbox/${encodeURIComponent(m.eventId)}/reply`,
      body: (m) => m.body || {},
    },

    // Playbooks ("mission sections" that bundle customized automations).
    // Registered here (not a bespoke proxy) so they inherit the X-Workspace-Id
    // header — playbooks scope to the active client workspace.
    "playbooks-list": { method: "GET", path: () => `/api/playbooks` },
    "playbook-create": { method: "POST", path: () => `/api/playbooks`, body: (m) => m.body || {} },
    "playbook-get": { method: "GET", path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}` },
    "playbook-patch": {
      method: "PATCH",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}`,
      body: (m) => m.body || {},
    },
    "playbook-delete": {
      method: "DELETE",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}`,
    },
    "playbook-attachable": {
      method: "GET",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}/attachable`,
    },
    "playbook-attach": {
      method: "POST",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}/attach`,
      body: (m) => m.body || {},
    },
    "playbook-detach": {
      method: "DELETE",
      path: (m) =>
        `/api/playbooks/${encodeURIComponent(m.id)}/attach/${encodeURIComponent(m.attachId)}`,
    },
    "playbook-templates": { method: "GET", path: () => `/api/playbooks/templates` },
    "playbook-install": {
      method: "POST",
      path: () => `/api/playbooks/install`,
      body: (m) => m.body || {},
    },
    "playbook-save-template": {
      method: "POST",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}/save-as-template`,
      body: (m) => m.body || {},
    },
    "playbook-preview": {
      method: "POST",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}/preview`,
      body: () => ({}),
    },
    "playbook-run": {
      method: "POST",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}/run`,
      body: () => ({}),
    },
    "playbook-catalog-add": {
      method: "POST",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}/catalog-add`,
      body: (m) => m.body || {},
    },
    "playbook-publish": {
      method: "POST",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}/publish`,
      body: (m) => m.body || {},
    },
    "playbook-unpublish": {
      method: "POST",
      path: (m) => `/api/playbooks/${encodeURIComponent(m.id)}/unpublish`,
      body: () => ({}),
    },

    // Clients (per-customer segmentation inside a workspace). Inherit X-Workspace-Id
    // so segments + reports scope to the active workspace.
    "clients-list": { method: "GET", path: () => `/api/clients` },
    "client-create": { method: "POST", path: () => `/api/clients`, body: (m) => m.body || {} },
    "client-get": { method: "GET", path: (m) => `/api/clients/${encodeURIComponent(m.id)}` },
    "client-update": {
      method: "PATCH",
      path: (m) => `/api/clients/${encodeURIComponent(m.id)}`,
      body: (m) => m.body || {},
    },
    "client-delete": {
      method: "DELETE",
      path: (m) => `/api/clients/${encodeURIComponent(m.id)}${m.queryString || ""}`,
    },
    "client-set-accounts": {
      method: "POST",
      path: (m) => `/api/clients/${encodeURIComponent(m.id)}/accounts`,
      body: (m) => m.body || {},
    },
    "client-companies": {
      method: "GET",
      path: (m) => `/api/clients/${encodeURIComponent(m.id)}/companies`,
    },
    "client-set-companies": {
      method: "POST",
      path: (m) => `/api/clients/${encodeURIComponent(m.id)}/companies`,
      body: (m) => m.body || {},
    },
    "account-set-clients": {
      method: "POST",
      path: (m) =>
        `/api/accounts/${encodeURIComponent(m.platform)}/${encodeURIComponent(m.accountId)}/clients`,
      body: (m) => m.body || {},
    },
    "work-tag-client": {
      method: "POST",
      path: (m) => `/api/work/${encodeURIComponent(m.kind)}/${encodeURIComponent(m.workId)}/client`,
      body: (m) => m.body || {},
    },
    "work-taggable": { method: "GET", path: () => `/api/work/taggable` },
    "client-report": { method: "GET", path: (m) => `/api/client-report${m.queryString || ""}` },
    "client-report-share": {
      method: "POST",
      path: () => `/api/client-report/share`,
      body: (m) => m.body || {},
    },
    "client-report-shares": {
      method: "GET",
      path: (m) => `/api/client-report/shares${m.queryString || ""}`,
    },
    "client-report-share-revoke": {
      method: "DELETE",
      path: (m) => `/api/client-report/share/${encodeURIComponent(m.token)}`,
    },
  };
  globalThis.NEXUS_DASHBOARD_ROUTES = DASHBOARD_ROUTES;
}
