// Mock data for Parcle Console

// Vendor definitions — geometric category icons (not branded marks), each tile gets
// an abstract glyph on a tinted colored background. Names are generic category names
// to avoid recreating branded product UI.
const VENDORS = {
  chatroom:  { name: 'Slack',      cat: 'Collaboration', color: '#4A154B', glyph: 'chat',    kind: 'chat' },
  meetchat:  { name: 'Microsoft Teams', cat: 'Collaboration', color: '#464EB8', glyph: 'chat', kind: 'chat' },
  discal:    { name: 'Discord',    cat: 'Collaboration', color: '#5865F2', glyph: 'chat',    kind: 'chat' },
  callsync:  { name: 'Zoom',       cat: 'Collaboration', color: '#2D8CFF', glyph: 'call',    kind: 'calls' },
  voxgrid:   { name: 'Gong',       cat: 'Collaboration', color: '#6A2CEA', glyph: 'call',    kind: 'calls' },
  gmail:     { name: 'Gmail',      cat: 'Collaboration', color: '#1A73E8', glyph: 'envelope',kind: 'email' },
  outmail:   { name: 'Outlook',    cat: 'Collaboration', color: '#0078D4', glyph: 'envelope',kind: 'email' },

  pagevault: { name: 'Notion',     cat: 'Docs & Wikis',  color: '#111827', glyph: 'doc',     kind: 'wiki' },
  wikiloom:  { name: 'Confluence', cat: 'Docs & Wikis',  color: '#0052CC', glyph: 'doc',     kind: 'wiki' },
  gdocs:     { name: 'Google Docs',cat: 'Docs & Wikis',  color: '#1A73E8', glyph: 'doc',     kind: 'docs' },
  codabook:  { name: 'Coda',       cat: 'Docs & Wikis',  color: '#F46A54', glyph: 'doc',     kind: 'docs' },

  cloudbin:  { name: 'Google Drive', cat: 'Files',       color: '#0B8043', glyph: 'file',    kind: 'files' },
  boxdrop:   { name: 'Dropbox',    cat: 'Files',         color: '#0061FF', glyph: 'file',    kind: 'files' },
  cratesvc:  { name: 'Box',        cat: 'Files',         color: '#0061D5', glyph: 'file',    kind: 'files' },
  bucket3:   { name: 'AWS S3',     cat: 'Files',         color: '#E85D04', glyph: 'bucket',  kind: 'files' },
  onevault:  { name: 'OneDrive',   cat: 'Files',         color: '#0364B8', glyph: 'file',    kind: 'files' },

  repohub:   { name: 'GitHub',     cat: 'Code',          color: '#24292F', glyph: 'branch',  kind: 'code' },
  gitlane:   { name: 'GitLab',     cat: 'Code',          color: '#FC6D26', glyph: 'branch',  kind: 'code' },
  bitforge:  { name: 'Bitbucket',  cat: 'Code',          color: '#0052CC', glyph: 'branch',  kind: 'code' },

  snowlake:  { name: 'Snowflake',  cat: 'Data Warehouse',color: '#29B5E8', glyph: 'db',      kind: 'dwh' },
  bigpool:   { name: 'BigQuery',   cat: 'Data Warehouse',color: '#4285F4', glyph: 'db',      kind: 'dwh' },
  redshift2: { name: 'Redshift',   cat: 'Data Warehouse',color: '#205081', glyph: 'db',      kind: 'dwh' },
  postgrex:  { name: 'Postgres',   cat: 'Data Warehouse',color: '#336791', glyph: 'db',      kind: 'db' },
  myvolt:    { name: 'MySQL',      cat: 'Data Warehouse',color: '#00618A', glyph: 'db',      kind: 'db' },

  salescrm:  { name: 'Salesforce', cat: 'CRM',           color: '#00A1E0', glyph: 'crm',     kind: 'crm' },
  hubforge:  { name: 'HubSpot',    cat: 'CRM',           color: '#FF7A59', glyph: 'crm',     kind: 'crm' },
  atomcrm:   { name: 'Attio',      cat: 'CRM',           color: '#4338CA', glyph: 'crm',     kind: 'crm' },

  deskzen:   { name: 'Zendesk',    cat: 'Support',       color: '#03363D', glyph: 'support', kind: 'support' },
  talkbox:   { name: 'Intercom',   cat: 'Support',       color: '#1F8DED', glyph: 'support', kind: 'support' },
  linebase:  { name: 'Linear',     cat: 'Support',       color: '#5E6AD2', glyph: 'issue',   kind: 'issues' },
  jiratide:  { name: 'Jira',       cat: 'Support',       color: '#0052CC', glyph: 'issue',   kind: 'issues' },

  segway:    { name: 'Segment',    cat: 'Product Analytics', color: '#52BD94', glyph: 'chart', kind: 'analytics' },
  amplify:   { name: 'Amplitude',  cat: 'Product Analytics', color: '#1E61F0', glyph: 'chart', kind: 'analytics' },
  mixtape:   { name: 'Mixpanel',   cat: 'Product Analytics', color: '#7856FF', glyph: 'chart', kind: 'analytics' },

  webhookc:  { name: 'Webhook',    cat: 'Custom',        color: '#6B7280', glyph: 'hook',    kind: 'custom' },
  restcustom:{ name: 'REST API',   cat: 'Custom',        color: '#6B7280', glyph: 'api',     kind: 'custom' },
  sqlcustom: { name: 'SQL Source', cat: 'Custom',        color: '#6B7280', glyph: 'db',      kind: 'custom' },
  upload:    { name: 'File Upload',cat: 'Custom',        color: '#6B7280', glyph: 'upload',  kind: 'custom' },
};

const CATEGORY_ORDER = [
  'Collaboration', 'Docs & Wikis', 'Files', 'Code',
  'Data Warehouse', 'CRM', 'Support', 'Product Analytics', 'Custom'
];

const CATEGORY_LABEL = {
  'Collaboration': 'Collaboration',
  'Docs & Wikis': 'Docs & Wikis',
  'Files': 'Files',
  'Code': 'Code',
  'Data Warehouse': 'Data Warehouses',
  'CRM': 'CRM',
  'Support': 'Support',
  'Product Analytics': 'Product Analytics',
  'Custom': 'Custom',
};

const CAT_LABEL_SHORT = {
  chat: 'chat', call: 'calls', doc: 'wiki', bucket: 'storage',
  file: 'files', branch: 'code', db: 'database', crm: 'crm',
  support: 'support', issue: 'issues', chart: 'analytics',
  hook: 'webhook', api: 'api', upload: 'upload'
};

// Connected sources (populated state)
const CONNECTED_SOURCES = [
  { id: 'chatroom',  volume: '412k msgs',    size: '3.2 GB',   rels: '184k',  synced: '2m',   used: '48s ago', status: 'live' },
  { id: 'pagevault', volume: '8.9k pages',   size: '1.1 GB',   rels: '62k',   synced: '34s',  used: '3m ago',  status: 'live' },
  { id: 'cloudbin',  volume: '224k files',   size: '418 GB',   rels: '91k',   synced: 'now',  used: '8m ago',  status: 'syncing', progress: 42 },
  { id: 'repohub',   volume: '312 repos',    size: '64 GB',    rels: '28k',   synced: '1m',   used: '2m ago',  status: 'live' },
  { id: 'postgrex',  volume: '48 schemas',   size: '1.8 TB',   rels: '412k',  synced: '3m',   used: '1m ago',  status: 'live' },
  { id: 'salescrm',  volume: '84k records',  size: '6.4 GB',   rels: '238k',  synced: '5m',   used: '14d ago', status: 'live' },
  { id: 'snowlake',  volume: '12 databases', size: '8.7 TB',   rels: '1.2M',  synced: '12m',  used: 'Never',   status: 'live' },
];

// Retrievals table data
const RETRIEVALS = [
  { id: 'req_81a4f', status: 'ok',      query: 'Pricing for enterprise',        client: 'Claude Code', cited: '4 of 5', sources: ['pagevault', 'cloudbin'], time: '10:42', key: 'pk_live_***_cc42', latency: 148 },
  { id: 'req_f32e0', status: 'ok',      query: 'Q4 forecast assumptions',        client: 'Codex',       cited: '3 of 3', sources: ['cloudbin'],              time: '10:40', key: 'pk_live_***_ax91', latency: 121 },
  { id: 'req_73b2a', status: 'noresult',query: 'GDPR DPA template',              client: 'Claude Code', cited: '0 of 5', sources: [],                        time: '10:38', key: 'pk_live_***_cc42', latency: 87 },
  { id: 'req_6c0e1', status: 'thumbs_up', query: 'Onboarding runbook',           client: 'Codex',       cited: '5 of 5', sources: ['pagevault', 'cloudbin', 'chatroom'], time: '10:32', key: 'pk_live_***_ax91', latency: 132 },
  { id: 'req_a92b1', status: 'thumbs_down', query: 'Eng hiring ladder',          client: 'Claude Code', cited: '2 of 4', sources: ['cloudbin'],              time: '10:21', key: 'pk_live_***_cc42', latency: 167 },
  { id: 'req_b11d2', status: 'ok',      query: "founder's view on safety",       client: 'OpenClaw',    cited: '4 of 6', sources: ['chatroom', 'pagevault'], time: '10:12', key: 'pk_live_***_a7f3', latency: 201 },
  { id: 'req_c77e3', status: 'ok',      query: 'SOC2 audit evidence vendor mgmt',client: 'Claude Code', cited: '6 of 6', sources: ['cloudbin', 'pagevault'], time: '10:04', key: 'pk_live_***_cc42', latency: 188 },
  { id: 'req_d42f4', status: 'ok',      query: 'retention policy legal team',     client: 'Hermes',      cited: '3 of 5', sources: ['pagevault'],             time: '09:58', key: 'pk_live_***_e7b', latency: 142 },
  { id: 'req_e01a5', status: 'noresult',query: 'vendor contract template',       client: 'Codex',       cited: '0 of 3', sources: [],                        time: '09:51', key: 'pk_live_***_ax91', latency: 73 },
  { id: 'req_f88c6', status: 'thumbs_up', query: 'embedding model switch plan',  client: 'Claude Code', cited: '4 of 4', sources: ['repohub', 'pagevault'],  time: '09:47', key: 'pk_live_***_cc42', latency: 159 },
  { id: 'req_1a2b7', status: 'ok',      query: 'weekly growth metrics',          client: 'Codex',       cited: '3 of 4', sources: ['snowlake', 'pagevault'], time: '09:42', key: 'pk_live_***_ax91', latency: 174 },
  { id: 'req_2b3c8', status: 'ok',      query: 'interview rubric senior eng',    client: 'Claude Code', cited: '5 of 5', sources: ['pagevault', 'cloudbin'], time: '09:33', key: 'pk_live_***_cc42', latency: 139 },
];

// Retrieval chunks for detail drawer
const RETRIEVAL_DETAIL = {
  id: 'req_81a4f',
  time: '10:42:11',
  client: 'Claude Code',
  key: 'pk_live_***_cc42',
  query: 'Pricing for enterprise',
  latency: 148,
  answer: "Enterprise pricing starts at $40,000/year for the Platform tier with 500,000 API calls included. Volume discounts begin at 1M calls/mo. Custom agreements are available for 5M+ call tiers.",
  chunks: [
    { idx: 1, cited: true,  conf: 0.93, text: '"Platform tier: $40,000/year, includes 500,000 API calls and unlimited seats. Overage billed at $0.004 per call…"', vendor: 'pagevault', path: 'Pricing / Enterprise tiers', updated: '3 days ago', updatedBy: 'Sarah K.' },
    { idx: 2, cited: true,  conf: 0.89, text: '"Volume discounts begin at 1,000,000 calls per month. See Appendix B for the tiered rate card…"', vendor: 'cloudbin', path: 'pricing-2026-q2.pdf · page 3', updated: '14 days ago', updatedBy: 'Sarah K.' },
    { idx: 3, cited: true,  conf: 0.84, text: '"Annual contracts may include a ramp clause where Year-1 commitment is 50% of Year-2 floor…"', vendor: 'pagevault', path: 'Legal / Contract terms', updated: '9 days ago', updatedBy: 'Marcus L.' },
    { idx: 4, cited: true,  conf: 0.78, text: '"Custom tier begins at 5M calls/mo and includes dedicated infrastructure and a named TAM…"', vendor: 'pagevault', path: 'Pricing / Custom tier', updated: '2 days ago', updatedBy: 'Sarah K.' },
    { idx: 5, cited: false, conf: 0.71, text: '"Legacy pricing (pre-2026): Starter $2k/mo, Growth $12k/mo, Enterprise from $30k/year…"', vendor: 'pagevault', path: 'Pricing archive', updated: '11 months ago', updatedBy: 'Sarah K.', stale: true },
  ],
};

// Usage sparkline data (30 days)
const USAGE_SPARK = [12,18,22,19,24,31,28,26,34,41,38,44,52,49,55,62,58,51,64,71,68,74,81,79,85,92,88,94,101,106];
const EMBED_SPARK = [8,11,14,12,16,20,19,22,25,28,26,31,35,33,38,42,40,44,48,52,51,55,58,60,63,67,69,72,76,78];
const COVERAGE_SPARK = [82,85,83,86,89,88,90,92,91,93,94,93,95,94,96,95,94,95,96,94,93,95,94,95,94,93,94,95,94,94];
const LATENCY_SPARK = [168,172,165,161,158,155,162,149,151,143,138,145,140,135,141,137,142,139,134,138,140,136,133,139,142,140,138,141,138,142];

// Home recent learnings
const LEARNINGS = [
  { id: 'l1', type: 'entity',   time: 'today', title: "New entity — Organization",
    body: "“Acme Corp” appeared in 3 Slack threads and 1 Salesforce record",
    evidence: ['#eng-standup · 2d', '#sales · 1d', 'Opportunity · Acme Corp Q4'], conf: 0.94 },
  { id: 'l2', type: 'dedupe',   time: 'today', title: "Concepts merged",
    body: "“Project Phoenix” is used interchangeably with “Q4 Migration Initiative” across 12 Notion pages and 4 Slack threads. Unified into a single concept.",
    evidence: ['Notion: roadmap', 'Notion: q4-plan', '#phoenix', '+9 more'], conf: 0.88 },
  { id: 'l3', type: 'rerank',   time: 'today', title: "Re-ranking — feedback-driven",
    body: "pricing-archive.md was down-ranked after 3 users flagged it as stale. Cited 7× last week; expected ~1×/week after adjustment.",
    evidence: [], conf: 1, applied: true },
  { id: 'l4', type: 'relation', time: 'yesterday', title: "New relationship",
    body: "“D. Amodei — works with → Safety Team” (inferred from 8 threads)",
    evidence: ['#safety · 5d', '#eng-safety · 3d'], conf: 0.82 },
];

const ENTITIES = [
  { type: 'Org',    name: 'Anthropic',       source: 'salescrm',  conf: 0.98, edges: 124 },
  { type: 'Person', name: 'D. Amodei',       source: 'pagevault', conf: 0.95, edges: 42 },
  { type: 'Prod.',  name: 'Claude 4',        source: 'repohub',   conf: 0.94, edges: 318 },
  { type: 'Team',   name: 'Growth',          source: 'chatroom',  conf: 0.91, edges: 27 },
  { type: 'Org',    name: 'Acme Corp',       source: 'salescrm',  conf: 0.94, edges: 8, isNew: true },
  { type: 'Person', name: 'Sarah Kim',       source: 'pagevault', conf: 0.92, edges: 61 },
  { type: 'Prod.',  name: 'Retrieval v3',    source: 'repohub',   conf: 0.89, edges: 87 },
  { type: 'Team',   name: 'Safety',          source: 'pagevault', conf: 0.93, edges: 54 },
  { type: 'Org',    name: 'Evergreen Labs',  source: 'salescrm',  conf: 0.87, edges: 21 },
  { type: 'Person', name: 'Marcus Leung',    source: 'chatroom',  conf: 0.90, edges: 38 },
  { type: 'Prod.',  name: 'Platform Tier',   source: 'pagevault', conf: 0.96, edges: 44 },
  { type: 'Team',   name: 'Engineering',     source: 'repohub',   conf: 0.97, edges: 212 },
  { type: 'Person', name: 'Priya Shah',      source: 'chatroom',  conf: 0.88, edges: 29 },
  { type: 'Doc',    name: 'Pricing tiers',   source: 'pagevault', conf: 0.99, edges: 16 },
  { type: 'Doc',    name: 'SOC2 playbook',   source: 'cloudbin',  conf: 0.91, edges: 11 },
  { type: 'Org',    name: 'Northwind Inc.',  source: 'salescrm',  conf: 0.83, edges: 17 },
];

const LOGS = [
  { t: '10:42:11', method: 'POST', path: '/v1/retrieve', status: 200, ms: 148, key: 'pk_live_***_cc42' },
  { t: '10:42:09', method: 'POST', path: '/v1/retrieve', status: 200, ms: 123, key: 'pk_live_***_ax91' },
  { t: '10:42:04', method: 'POST', path: '/v1/retrieve', status: 429, ms: 12,  key: 'pk_dev_3a11_bb' },
  { t: '10:42:01', method: 'GET',  path: '/v1/entities', status: 200, ms: 92,  key: 'pk_live_***_cc42' },
  { t: '10:41:58', method: 'POST', path: '/v1/retrieve', status: 500, ms: 301, key: 'pk_live_***_cc42' },
  { t: '10:41:52', method: 'POST', path: '/v1/retrieve', status: 200, ms: 139, key: 'pk_live_***_cc42' },
  { t: '10:41:47', method: 'GET',  path: '/v1/documents',status: 200, ms: 64,  key: 'pk_live_***_ax91' },
  { t: '10:41:41', method: 'POST', path: '/v1/retrieve', status: 200, ms: 112, key: 'pk_live_***_cc42' },
  { t: '10:41:33', method: 'POST', path: '/v1/retrieve', status: 200, ms: 157, key: 'pk_live_***_e7b' },
  { t: '10:41:28', method: 'GET',  path: '/v1/graph',    status: 200, ms: 81,  key: 'pk_live_***_cc42' },
  { t: '10:41:20', method: 'POST', path: '/v1/retrieve', status: 200, ms: 144, key: 'pk_live_***_ax91' },
];

Object.assign(window, {
  VENDORS, CATEGORY_ORDER, CATEGORY_LABEL, CAT_LABEL_SHORT,
  CONNECTED_SOURCES, RETRIEVALS, RETRIEVAL_DETAIL,
  USAGE_SPARK, EMBED_SPARK, COVERAGE_SPARK, LATENCY_SPARK,
  LEARNINGS, ENTITIES, LOGS
});
