// Static data: projects, agents, modules, tasks, activity

const PROJECTS = [
  { id: 'zeny',     name: 'Zeny.Studio',   color: 'oklch(0.65 0.16 280)' },
  { id: 'vidix',    name: 'Vidix.Studio',  color: 'oklch(0.65 0.15 200)' },
  { id: 'tlsdeck',  name: 'TLSDeck.pro',   color: 'oklch(0.7 0.15 150)' },
  { id: 'worldtime', name: 'WorldTime',    color: 'oklch(0.7 0.16 60)' },
];

const AGENTS = [
  { id: 'installer-agent', kind: 'installer', state: 'running', tasks: 3 },
  { id: 'tester-agent',    kind: 'tester',    state: 'running', tasks: 5 },
  { id: 'reviewer-agent',  kind: 'reviewer',  state: 'idle',    tasks: 0 },
  { id: 'migrator-agent',  kind: 'migrator',  state: 'running', tasks: 2 },
  { id: 'sentinel-agent',  kind: 'sentinel',  state: 'idle',    tasks: 0 },
  { id: 'rollback-agent',  kind: 'rollback',  state: 'idle',    tasks: 0 },
];

const COLUMNS = [
  { id: 'backlog', name: 'Backlog',  status: 'backlog', desc: 'Queued, not yet picked up' },
  { id: 'ready',   name: 'Ready',    status: 'ready',   desc: 'Validated & dispatchable' },
  { id: 'running', name: 'Running',  status: 'running', desc: 'In execution by agents' },
  { id: 'review',  name: 'Review',   status: 'review',  desc: 'Awaiting human approval' },
  { id: 'done',    name: 'Done',     status: 'done',    desc: 'Completed successfully' },
  { id: 'failed',  name: 'Failed',   status: 'failed',  desc: 'Halted — requires action' },
];

const TASKS = [
  // Backlog
  { id: 'TSK-4012', title: 'Install Billing Module v1.2.0', project: 'zeny', type: 'module-install',
    agent: 'installer-agent', priority: 'high', column: 'backlog', progress: 0,
    affectsDb: true, requiresApproval: true, version: 'v1.2.0', updated: '2m ago' },
  { id: 'TSK-4013', title: 'Patch CVE-2026-1041 in Auth/JWT pipeline', project: 'vidix', type: 'system-task',
    agent: 'sentinel-agent', priority: 'high', column: 'backlog', progress: 0,
    affectsDb: false, requiresApproval: true, version: 'auth@2.4.1', updated: '5m ago' },
  { id: 'TSK-4014', title: 'Generate seed data for staging tenants', project: 'worldtime', type: 'agent-task',
    agent: 'installer-agent', priority: 'low', column: 'backlog', progress: 0,
    affectsDb: true, requiresApproval: false, version: 'seed@0.9', updated: '11m ago' },
  { id: 'TSK-4015', title: 'Provision read-replica for analytics warehouse', project: 'tlsdeck', type: 'system-task',
    agent: 'migrator-agent', priority: 'medium', column: 'backlog', progress: 0,
    affectsDb: true, requiresApproval: true, version: 'pg@16.2', updated: '18m ago' },

  // Ready
  { id: 'TSK-4006', title: 'Update Tickets module to v3.0.1', project: 'vidix', type: 'update',
    agent: 'installer-agent', priority: 'medium', column: 'ready', progress: 0,
    affectsDb: false, requiresApproval: false, version: 'v3.0.1', updated: 'just now' },
  { id: 'TSK-4007', title: 'Rotate API signing keys (us-east-2)', project: 'tlsdeck', type: 'system-task',
    agent: 'sentinel-agent', priority: 'high', column: 'ready', progress: 0,
    affectsDb: false, requiresApproval: false, version: 'kms@4', updated: '1m ago' },
  { id: 'TSK-4008', title: 'Run regression suite on staging.zeny', project: 'zeny', type: 'agent-task',
    agent: 'tester-agent', priority: 'medium', column: 'ready', progress: 0,
    affectsDb: false, requiresApproval: false, version: 'qa@latest', updated: '3m ago' },

  // Running
  { id: 'TSK-3998', title: 'Migrate users table to partitioned schema', project: 'tlsdeck', type: 'system-task',
    agent: 'migrator-agent', priority: 'high', column: 'running', progress: 62,
    affectsDb: true, requiresApproval: true, version: 'pg@16.2', updated: 'now', running: true },
  { id: 'TSK-3999', title: 'Install Blog Module v0.8.4', project: 'worldtime', type: 'module-install',
    agent: 'installer-agent', priority: 'low', column: 'running', progress: 28,
    affectsDb: true, requiresApproval: false, version: 'v0.8.4', updated: 'now', running: true },
  { id: 'TSK-4000', title: 'Crawl knowledge base & rebuild embeddings', project: 'vidix', type: 'agent-task',
    agent: 'tester-agent', priority: 'medium', column: 'running', progress: 81,
    affectsDb: true, requiresApproval: false, version: 'kb@2.1', updated: 'now', running: true },

  // Review
  { id: 'TSK-3987', title: 'Replace Stripe webhook handlers with v3 SDK', project: 'vidix', type: 'update',
    agent: 'reviewer-agent', priority: 'high', column: 'review', progress: 100,
    affectsDb: false, requiresApproval: true, version: 'v3.0.0', updated: '12m ago' },
  { id: 'TSK-3988', title: 'Backfill missing org_id on legacy invoices', project: 'tlsdeck', type: 'system-task',
    agent: 'reviewer-agent', priority: 'medium', column: 'review', progress: 100,
    affectsDb: true, requiresApproval: true, version: 'mig@2026.04', updated: '24m ago' },

  // Done
  { id: 'TSK-3964', title: 'Install Auth Module v2.4.0', project: 'zeny', type: 'module-install',
    agent: 'installer-agent', priority: 'medium', column: 'done', progress: 100,
    affectsDb: true, requiresApproval: false, version: 'v2.4.0', updated: '1h ago' },
  { id: 'TSK-3965', title: 'Bump Next.js runtime to 15.3', project: 'zeny', type: 'update',
    agent: 'installer-agent', priority: 'low', column: 'done', progress: 100,
    affectsDb: false, requiresApproval: false, version: 'next@15.3', updated: '2h ago' },
  { id: 'TSK-3966', title: 'Deploy autoscaler config to prod-us', project: 'vidix', type: 'system-task',
    agent: 'sentinel-agent', priority: 'medium', column: 'done', progress: 100,
    affectsDb: false, requiresApproval: false, version: 'autoscale@1.7', updated: '3h ago' },

  // Failed
  { id: 'TSK-3954', title: 'Install Analytics Module v0.4.0', project: 'worldtime', type: 'module-install',
    agent: 'installer-agent', priority: 'medium', column: 'failed', progress: 41,
    affectsDb: true, requiresApproval: false, version: 'v0.4.0', updated: '38m ago',
    error: 'dependency conflict: pg-extensions/citext@1.6.3 missing' },
];

const MODULES = [
  { id: 'billing', name: 'Billing', version: 'v1.2.0', installed: 'v1.1.4', status: 'update',
    desc: 'Subscription billing, dunning, tax, invoices. Stripe + Lago + Paddle adapters.',
    icon: '$',  iconBg: 'oklch(0.6 0.16 280)', size: '4.2 MB', deps: 7, signedBy: 'core' },
  { id: 'blog', name: 'Blog', version: 'v0.8.4', installed: null, status: 'idle',
    desc: 'MDX-based content engine with scheduled publish, RSS, taxonomy, SEO meta.',
    icon: 'B',  iconBg: 'oklch(0.65 0.15 60)', size: '1.6 MB', deps: 3, signedBy: 'core' },
  { id: 'tickets', name: 'Tickets', version: 'v3.0.1', installed: 'v2.9.0', status: 'update',
    desc: 'Multi-channel support inbox: email, Slack, in-app. SLA tracking + escalation rules.',
    icon: 'T',  iconBg: 'oklch(0.65 0.15 200)', size: '2.9 MB', deps: 5, signedBy: 'core' },
  { id: 'auth', name: 'Auth', version: 'v2.4.0', installed: 'v2.4.0', status: 'live',
    desc: 'OIDC, SAML, SCIM provisioning, passkeys, session policies, MFA enforcement.',
    icon: 'A',  iconBg: 'oklch(0.6 0.15 150)', size: '3.4 MB', deps: 4, signedBy: 'core' },
  { id: 'analytics', name: 'Analytics', version: 'v0.4.0', installed: 'v0.3.7', status: 'failed',
    desc: 'Event capture, retention curves, funnel analysis. ClickHouse backend.',
    icon: 'Λ',  iconBg: 'oklch(0.65 0.18 30)', size: '5.1 MB', deps: 6, signedBy: 'labs' },
  { id: 'kb', name: 'Knowledge', version: 'v2.1.0', installed: 'v2.1.0', status: 'live',
    desc: 'Vector + lexical hybrid search over docs, tickets, code. Rebuildable indexes.',
    icon: 'K',  iconBg: 'oklch(0.65 0.16 320)', size: '6.8 MB', deps: 9, signedBy: 'core' },
  { id: 'workflows', name: 'Workflows', version: 'v1.0.0', installed: null, status: 'new',
    desc: 'Agent-graph orchestration with retries, branches, durable timers. Beta.',
    icon: 'W',  iconBg: 'oklch(0.6 0.14 240)', size: '2.1 MB', deps: 4, signedBy: 'labs' },
  { id: 'audit', name: 'Audit Trail', version: 'v1.7.2', installed: 'v1.7.2', status: 'live',
    desc: 'Append-only event log with hash chain, exportable to SIEM (Splunk, Datadog).',
    icon: '∮',  iconBg: 'oklch(0.55 0.06 260)', size: '0.9 MB', deps: 2, signedBy: 'core' },
];

const ACTIVITY = [
  { color: 'var(--c-status-done)',    text: '<b>installer-agent</b> installed <b>auth@2.4.0</b> on <b>prod-us</b>', time: '00:14:22 UTC' },
  { color: 'var(--c-status-running)', text: '<b>migrator-agent</b> began partition rollout on <b>users</b> (4/12 shards)', time: '00:13:08 UTC' },
  { color: 'var(--c-status-review)',  text: '<b>reviewer-agent</b> requested approval on <b>TSK-3987</b> (Stripe v3)', time: '00:11:51 UTC' },
  { color: 'var(--c-status-failed)',  text: '<b>installer-agent</b> halted on <b>analytics@0.4.0</b> — dependency conflict', time: '00:09:42 UTC' },
  { color: 'var(--c-status-running)', text: '<b>tester-agent</b> dispatched 218 regression assertions', time: '00:07:30 UTC' },
  { color: 'var(--c-status-done)',    text: '<b>sentinel-agent</b> rotated KMS keys, propagated to 14 services', time: '00:04:12 UTC' },
  { color: 'var(--c-status-done)',    text: 'Patch <b>next@15.3</b> applied across 3 projects', time: '23:58:01 UTC' },
];

const NAV_ITEMS = [
  { id: 'board',     name: 'Board',          icon: 'columns',   badge: '17' },
  { id: 'projects',  name: 'Projects',       icon: 'folder',    badge: '4'  },
  { id: 'modules',   name: 'Modules',        icon: 'box',       badge: '8'  },
  { id: 'agents',    name: 'Agents',         icon: 'cpu',       badge: '6'  },
  { id: 'kb',        name: 'Knowledge Base', icon: 'book' },
  { id: 'settings',  name: 'Settings',       icon: 'settings' },
];

window.ORC_DATA = { PROJECTS, AGENTS, COLUMNS, TASKS, MODULES, ACTIVITY, NAV_ITEMS };
