import { LocalModelRole } from '@claw/shared-types';
import { z } from 'zod';

export const LOCAL_PROVIDER = 'local-ollama';
export const LOCAL_MODEL_DEFAULT = 'AUTO';
export const LOCAL_MODEL_ROUTER = 'qwen3:1.7b';
export const LOCAL_MODEL_FAST = 'AUTO';

// Provider names must match the ConnectorProvider Prisma enum (uppercase)
export const CLOUD_PROVIDER_OPENAI = 'OPENAI';
export const CLOUD_PROVIDER_ANTHROPIC = 'ANTHROPIC';
export const CLOUD_PROVIDER_GEMINI = 'GEMINI';
export const CLOUD_PROVIDER_DEEPSEEK = 'DEEPSEEK';
export const CLOUD_PROVIDER_GROK = 'GROK';
export const CLOUD_MODEL_GROK_DEFAULT = 'grok-3-mini';

export const CLOUD_MODEL_REASONING = 'claude-opus-4';
export const CLOUD_MODEL_FAST = 'gpt-4o-mini';
export const CLOUD_MODEL_CHEAP = 'gpt-4o-mini';
export const CLOUD_MODEL_DEFAULT = 'claude-sonnet-4';
export const CLOUD_MODEL_GEMINI_DEFAULT = 'gemini-2.5-flash';

// Image generation providers
export const IMAGE_PROVIDER_OPENAI = 'IMAGE_OPENAI';
export const IMAGE_PROVIDER_GEMINI = 'IMAGE_GEMINI';
export const IMAGE_PROVIDER_LOCAL = 'IMAGE_LOCAL';
export const IMAGE_MODEL_DALLE3 = 'dall-e-3';
export const IMAGE_MODEL_IMAGEN = 'gemini-2.5-flash-image';
export const IMAGE_MODEL_SD_LOCAL = 'sdxl-turbo';

export const IMAGE_KEYWORDS = [
  'generate an image',
  'generate image',
  'generate a picture',
  'generate picture',
  'create an image',
  'create image',
  'create a picture',
  'create picture',
  'draw me',
  'draw a',
  'draw an',
  'draw the',
  'make an image',
  'make a picture',
  'make me an image',
  'make me a picture',
  'design an image',
  'design a logo',
  'sketch',
  'illustration of',
  'paint me',
  'paint a',
  'photo of',
  'photograph of',
  'render an image',
  'render a',
  'visualize',
  'depict',
  // Reference-based image generation phrases
  'generate similar',
  'similar to this',
  'like this image',
  'recreate this',
  'recreate the image',
  'reproduce this',
  'copy this image',
  'same style as',
  'based on this image',
  'inspired by this',
  'variation of this',
  'generate from this',
  'create from this',
  'make one like this',
  'make something like',
  'generate like this',
  'create similar',
  'similar image',
  'image like this',
  'remake this',
  'redo this image',
  // Scene/location prompts that imply image generation
  'fantasy map',
  'travel poster',
  'floor plan',
  'book cover',
  'album cover',
  'movie poster',
  'game character',
  'profile picture',
  'social media post',
  'app icon',
  // Single-word strong indicators
  'render ',
  'photo ',
  'portrait ',
  'illustration ',
  'poster ',
  'sticker ',
  'logo ',
  'banner ',
  'mascot ',
];

// File generation provider
export const FILE_GENERATION_PROVIDER = 'FILE_GENERATION';

// Regex-based file generation detection:
// Matches any combination of action verb + file format keyword
// e.g., "generate dummy pdf", "create a text file", "make me a csv report"
export const FILE_GENERATION_VERBS = [
  'generate',
  'create',
  'make',
  'write',
  'export',
  'save',
  'output',
  'produce',
  'build',
  'turn',
  'convert',
  'transform',
  'compile',
  'package',
  'assemble',
];
export const FILE_GENERATION_FORMAT_WORDS = [
  'file',
  'pdf',
  'document',
  'csv',
  'docx',
  'word',
  'txt',
  'text file',
  'markdown',
  'json',
  'html',
  'report',
  'brief',
  'spreadsheet',
  'worksheet',
  'deck',
  'presentation',
  'slides',
  'one-pager',
  'memo',
  'proposal',
  '.md',
  '.pdf',
  '.csv',
  '.docx',
  '.txt',
  '.json',
  '.html',
];

// Also keep exact phrases for high-confidence matches
export const FILE_GENERATION_KEYWORDS = [
  'export as',
  'export to',
  'save as',
  'download as',
  'save to file',
  'write to file',
  'output as file',
];

export const VALID_PROVIDERS = new Set([
  LOCAL_PROVIDER,
  CLOUD_PROVIDER_OPENAI,
  CLOUD_PROVIDER_ANTHROPIC,
  CLOUD_PROVIDER_GEMINI,
  CLOUD_PROVIDER_DEEPSEEK,
  CLOUD_PROVIDER_GROK,
  IMAGE_PROVIDER_OPENAI,
  IMAGE_PROVIDER_GEMINI,
  IMAGE_PROVIDER_LOCAL,
  FILE_GENERATION_PROVIDER,
]);

export const ollamaRouterResponseSchema = z.object({
  provider: z.string().min(1),
  model: z.string().min(1),
  confidence: z.number().min(0).max(1),
  reason: z.string().min(1),
});

export const ROUTER_PROMPT_TEMPLATE = `You are an intelligent AI routing engine. Analyze the user message and decide which AI provider and model is best suited to answer it.

Available providers and models:

LOCAL MODELS (free, private, no internet needed):
- local-ollama / AUTO (default local response model resolved from the currently installed models)
- local-ollama / qwen3:1.7b (router-only model; do not use as a response model)

CLOUD MODELS (paid, internet required, higher quality):
- OPENAI / gpt-4o-mini (fast, general purpose, good for summarization, chat, writing)
- ANTHROPIC / claude-sonnet-4 (excellent coding, debugging, code review, technical analysis)
- ANTHROPIC / claude-opus-4 (best for deep reasoning, complex analysis, architecture decisions)
- GEMINI / gemini-2.5-flash (fast, multimodal, best for image/video, web search, YouTube, file analysis)
- DEEPSEEK / deepseek-chat (strong coding and math, very low cost)

IMAGE GENERATION MODELS (generate images from text prompts):
- IMAGE_OPENAI / dall-e-3 (best quality, photorealistic images, DALL-E 3)
- IMAGE_GEMINI / gemini-2.5-flash-image (Google Gemini 2.5 image generation)
- IMAGE_LOCAL / sdxl-turbo (local Stable Diffusion, free, no internet, lower quality)

Healthy providers: {healthyProviders}

ROUTING RULES (follow strictly, in priority order):

IMAGE GENERATION (highest priority — detect these first):
- Any request to generate, create, draw, make, paint, render, design an image/picture/photo/portrait/illustration/sketch/art/logo/poster → IMAGE_GEMINI / gemini-2.5-flash-image
- "generate similar to this", "recreate this image", "make one like this" (referencing attached files) → IMAGE_GEMINI / gemini-2.5-flash-image
- "generate image", "create picture", "draw me", "make a photo" → IMAGE_GEMINI / gemini-2.5-flash-image

FILE GENERATION:
- Create/generate/export/save a file/document/PDF/CSV/DOCX/report → FILE_GENERATION / auto
- "generate text file", "create a PDF", "export as CSV" → FILE_GENERATION / auto

TEXT TASKS:
- Coding, debugging, code review, refactoring → ANTHROPIC / claude-sonnet-4
- Complex reasoning, architecture, system design → ANTHROPIC / claude-opus-4
- Image analysis, vision, describing attached images → GEMINI / gemini-2.5-flash
- Math, algorithms, competitive programming → DEEPSEEK / deepseek-chat or local-ollama / AUTO
- Creative writing, storytelling, marketing copy → OPENAI / gpt-4o-mini
- Simple greetings, translations, quick facts → local-ollama / AUTO
- General chat, summarization, email drafting → local-ollama / AUTO or OPENAI / gpt-4o-mini
- Data analysis, CSV/JSON/file parsing → GEMINI / gemini-2.5-flash
- Privacy-sensitive requests → local-ollama / AUTO (never send to cloud)

GENERAL RULES:
- ONLY route to healthy providers listed above
- Prefer local models when quality is acceptable for the task
- When in doubt between image generation and text → check if the user wants a visual output
- If unsure or ambiguous → GEMINI / gemini-2.5-flash (best general purpose)

Respond with ONLY a JSON object (no markdown, no explanation):
{{"provider":"...","model":"...","confidence":0.X,"reason":"brief reason"}}

User message: {message}`;

export const CODING_KEYWORDS = [
  'code',
  'debug',
  'function',
  'refactor',
  'bug',
  'implement',
  'class',
  'method',
  'compile',
  'syntax',
  'error in my code',
  'write a function',
  'fix this bug',
  'code review',
  'pull request',
  'git',
  'api endpoint',
  'unit test',
  'integration test',
  'typescript',
  'javascript',
  'python',
  'react',
  'component',
  'database query',
  'sql',
  'algorithm',
  'data structure',
  'decorator',
  'middleware',
  'endpoint',
  'controller',
  'service',
  'repository',
  'migration',
  'schema',
  'query builder',
  'ORM',
  'REST',
  'GraphQL',
  'WebSocket',
  'microservice',
  'monorepo',
  'linting',
  'prettier',
  'webpack',
  'vite',
  'turbopack',
  'npm',
  'yarn',
  'pnpm',
  'package.json',
  'tsconfig',
  'dockerfile',
  'docker-compose',
  'CI/CD',
  'github actions',
  'jest',
  'vitest',
  'playwright',
  'cypress',
  'mocha',
  'chai',
  'supertest',
  'mock',
  'stub',
  'spy',
  'fixture',
  'snapshot',
  'coverage',
  'branch',
  'merge',
  'rebase',
  'cherry-pick',
  'stash',
  'commit',
  'pair programming',
  'clean code',
  'SOLID',
  'DRY',
  'KISS',
  'design pattern',
  'factory',
  'singleton',
  'observer',
  'strategy',
  'adapter',
  'dependency injection',
  'interface',
  'abstract class',
  'generic',
  'type',
  'enum',
  'async',
  'promise',
  'callback',
  'stream',
  'buffer',
  'event loop',
  'thread',
  'process',
  'worker',
  'cluster',
  'load balancer',
  'reverse proxy',
  'rate limit',
  'circuit breaker',
  'retry',
  'backoff',
  'cache',
  'Redis',
  'MongoDB',
  'PostgreSQL',
  'MySQL',
  'Prisma',
  'TypeORM',
  'Sequelize',
  'Mongoose',
  // Mobile / cross-platform keywords
  'mobile app',
  'React Native',
  'Flutter',
  'Swift',
  'Kotlin',
  'iOS',
  'Android',
  'Xcode',
  'gradle',
  'SwiftUI',
  'Jetpack Compose',
  'Expo',
  'Capacitor',
  'Ionic',
  'Cordova',
  'APK',
  'IPA',
  'app store',
  'play store',
  'push notification',
  'deep linking',
  'universal link',
  // Game development keywords
  'Unity',
  'Unreal Engine',
  'game loop',
  'shader',
  'sprite',
  'collision detection',
  'physics engine',
  'game engine',
  'Godot',
  'Phaser',
  'Three.js',
  'WebGL',
  'OpenGL',
  'Vulkan',
  'DirectX',
  'mesh',
  'texture mapping',
  'ray tracing',
  'particle system',
  'skeletal animation',
  'pathfinding',
  'A-star',
  'navmesh',
  'tilemap',
  'hitbox',
  // Blockchain / Web3 keywords
  'blockchain',
  'Solidity',
  'smart contract',
  'Web3',
  'ethers.js',
  'hardhat',
  'DeFi',
  'token',
  'NFT',
  'dApp',
  'Truffle',
  'Foundry',
  'Vyper',
  'ERC-20',
  'ERC-721',
  'Metamask',
  'wallet connect',
  'gas optimization',
  'reentrancy',
  'flash loan',
  'liquidity pool',
  'staking',
  'yield farming',
  'DAO',
  'governance token',
  'IPFS',
  'Chainlink',
  'oracle',
  // Embedded / IoT / robotics keywords
  'embedded',
  'firmware',
  'RTOS',
  'microcontroller',
  'Arduino',
  'Raspberry Pi',
  'sensor',
  'actuator',
  'GPIO',
  'SPI',
  'I2C',
  'UART',
  'STM32',
  'ESP32',
  'FreeRTOS',
  'Zephyr',
  'bare metal',
  'bootloader',
  'interrupt handler',
  'DMA',
  'PWM',
  'ADC',
  'DAC',
  'CAN bus',
  'Modbus',
  'ROS',
  'robot operating system',
  'inverse kinematics',
  'SLAM',
  'lidar',
  'odometry',
  // Frontend-specific keywords
  'CSS',
  'flexbox',
  'grid layout',
  'responsive design',
  'media query',
  'useState',
  'useEffect',
  'useContext',
  'useReducer',
  'useMemo',
  'useCallback',
  'useRef',
  'Next.js',
  'Nuxt',
  'Svelte',
  'Angular',
  'Vue',
  'Tailwind',
  'shadcn',
  'Radix',
  'styled-components',
  'emotion',
  'framer-motion',
  'react-query',
  'SWR',
  'redux',
  'zustand',
  'SSR',
  'ISR',
  'hydration',
  'RSC',
  'server component',
  'client component',
  'suspense',
  'lazy loading',
  'code splitting',
  'tree shaking',
  'bundle size',
  'lighthouse',
  'web vitals',
  'CLS',
  'LCP',
  'FID',
  'accessibility',
  'ARIA',
  'WCAG',
  'semantic HTML',
  // DevOps/SRE keywords
  'Prometheus',
  'Grafana',
  'Datadog',
  'NewRelic',
  'PagerDuty',
  'OpsGenie',
  'runbook',
  'SLO',
  'SLI',
  'SLA',
  'error budget',
  'toil',
  'postmortem',
  'blameless',
  'chaos engineering',
  'canary deployment',
  'blue-green',
  'rolling update',
  'feature flag',
  'service mesh',
  'sidecar',
  'envoy',
  'istio',
  'linkerd',
  // QA/Testing keywords
  'Selenium',
  'Puppeteer',
  'TestCafe',
  'BDD',
  'TDD',
  'Gherkin',
  'cucumber',
  'given-when-then',
  'test plan',
  'test case',
  'test suite',
  'regression test',
  'smoke test',
  'sanity check',
  'boundary testing',
  'equivalence partitioning',
  'load test',
  'stress test',
  'k6',
  'JMeter',
  'Gatling',
  'Locust',
];

export const REASONING_KEYWORDS = [
  'prove',
  'solve',
  'calculate',
  'analyze',
  'derive',
  'logic',
  'theorem',
  'equation',
  'mathematical',
  'probability',
  'statistics',
  'optimization',
  'constraint',
  'inference',
  'deduce',
  'hypothesis',
  'formal proof',
  'step by step',
  'chain of thought',
  'why does',
  'explain the reasoning',
];

export const THINKING_KEYWORDS = [
  'research',
  'search for',
  'find information',
  'investigate',
  'compare and contrast',
  'evaluate',
  'assess',
  'deep dive',
  'comprehensive analysis',
  'pros and cons',
  'trade-offs',
  'what are the options',
  'current state of',
  'latest developments',
  'how does X compare to Y',
];

export const INFRASTRUCTURE_KEYWORDS = [
  'terraform',
  'ansible',
  'kubernetes',
  'k8s',
  'helm',
  'docker',
  'container',
  'pod',
  'deployment',
  'service mesh',
  'istio',
  'envoy',
  'nginx',
  'apache',
  'SSL',
  'TLS',
  'certificate',
  'DNS',
  'CDN',
  'cloudflare',
  'AWS',
  'GCP',
  'Azure',
  'EC2',
  'S3',
  'Lambda',
  'serverless',
  'VPC',
  'subnet',
  'security group',
  'IAM',
  'auto scaling',
  'ECS',
  'EKS',
  'fargate',
  // Industrial IoT / SCADA / energy keywords
  'SCADA',
  'PLC',
  'HMI',
  'industrial IoT',
  'OPC-UA',
  'MQTT',
  'digital twin',
  'predictive maintenance',
  'vibration analysis',
  'condition monitoring',
  'power grid',
  'smart grid',
  'solar',
  'wind energy',
  'battery storage',
  'microgrid',
  'energy management',
  'building automation',
  'BMS',
  'HVAC control',
  'smart factory',
  'industry 4.0',
  'MES',
  'historian',
  'DCS',
  'RTU',
  'ladder logic',
  'IEC 61131',
  'ISA-95',
  'OT security',
  // Advanced infrastructure keywords
  'Pulumi',
  'CDK',
  'CloudFormation',
  'Crossplane',
  'ArgoCD',
  'FluxCD',
  'GitOps',
  'Tekton',
  'Buildpacks',
  'Knative',
  'KEDA',
  'HPA',
  'VPA',
  'pod disruption budget',
  'node affinity',
  'taint',
  'toleration',
  'daemonset',
  'statefulset',
  'operator pattern',
  'CRD',
  'admission webhook',
  'mutating webhook',
  'validating webhook',
];

export const DATA_ANALYSIS_KEYWORDS = [
  'dataset',
  'dataframe',
  'pandas',
  'numpy',
  'matplotlib',
  'seaborn',
  'plotly',
  'chart',
  'graph',
  'visualization',
  'pivot table',
  'aggregation',
  'GROUP BY',
  'JOIN',
  'window function',
  'CTE',
  'subquery',
  'ETL',
  'pipeline',
  'data warehouse',
  'BigQuery',
  'Redshift',
  'Snowflake',
  'dbt',
  'Airflow',
  'Spark',
  'Hadoop',
  'Kafka',
  'data lake',
  'schema design',
  'normalization',
  'denormalization',
  'OLAP',
  'OLTP',
  // Bioinformatics / genomics keywords
  'bioinformatics',
  'genome',
  'BLAST',
  'sequence alignment',
  'ChIP-seq',
  'RNA-seq',
  'proteomics',
  'mass spectrometry',
  'GWAS',
  'variant calling',
  'phylogenetics',
  'metagenomics',
  'single-cell',
  'transcriptomics',
  // Computer vision keywords
  'computer vision',
  'OpenCV',
  'YOLO',
  'object detection',
  'segmentation',
  'OCR',
  'face recognition',
  'image classification',
  'pose estimation',
  'depth estimation',
  'optical flow',
  'feature extraction',
  'edge detection',
  'contour detection',
  'bounding box',
  'anchor box',
  'non-max suppression',
  // NLP keywords
  'NLP',
  'tokenizer',
  'named entity recognition',
  'sentiment analysis',
  'word2vec',
  'BERT',
  'GPT',
  'LLM',
  'RAG',
  'retrieval augmented',
  'text classification',
  'topic modeling',
  'dependency parsing',
  'coreference resolution',
  'text generation',
  'summarization model',
  'question answering',
  'semantic similarity',
  'language model',
  // Recommendation systems keywords
  'recommendation system',
  'collaborative filtering',
  'content-based filtering',
  'A/B test',
  'feature flag',
  'experimentation',
  'matrix factorization',
  'cold start problem',
  'click-through rate',
  'implicit feedback',
  'explicit feedback',
  'ranking model',
  'personalization',
  // ML/AI keywords
  'scikit-learn',
  'TensorFlow',
  'PyTorch',
  'Keras',
  'XGBoost',
  'LightGBM',
  'RandomForest',
  'neural network',
  'CNN',
  'RNN',
  'LSTM',
  'transformer',
  'attention mechanism',
  'embedding',
  'fine-tuning',
  'transfer learning',
  'RLHF',
  'DPO',
  'LoRA',
  'QLoRA',
  'quantization',
  'GGUF',
  'ONNX',
  'TensorRT',
  'MLflow',
  'Weights and Biases',
  'Hugging Face',
  // Statistics keywords
  'p-value',
  'confidence interval',
  'chi-square',
  't-test',
  'ANOVA',
  'Bayesian',
  'posterior',
  'prior',
  'likelihood',
  'multivariate',
  'PCA',
  'clustering',
  'k-means',
  'DBSCAN',
  'dimensionality reduction',
  'feature importance',
  'cross-validation',
  'overfitting',
  'underfitting',
  'bias-variance',
  'ROC',
  'AUC',
  'precision',
  'recall',
  'F1',
];

export const BUSINESS_KEYWORDS = [
  'user story',
  'acceptance criteria',
  'sprint',
  'backlog',
  'roadmap',
  'KPI',
  'OKR',
  'conversion rate',
  'funnel',
  'A/B test',
  'campaign',
  'ROI',
  'revenue',
  'budget',
  'forecast',
  'market analysis',
  'competitor',
  'SWOT',
  'business case',
  'proposal',
  'RFP',
  'pitch deck',
  'stakeholder',
  'quarterly review',
  'board meeting',
  'executive summary',
  'strategic plan',
  'go-to-market',
  'pricing strategy',
  'churn rate',
  // Ecommerce / retail keywords
  'ecommerce',
  'Shopify',
  'WooCommerce',
  'marketplace',
  'fulfillment',
  'dropshipping',
  'retail analytics',
  'planogram',
  'assortment planning',
  'markdown optimization',
  'demand planning',
  'demand sensing',
  'revenue operations',
  'RevOps',
  'territory planning',
  'channel sales',
  'partner enablement',
  'account-based marketing',
  'ABM',
  'lifecycle marketing',
  'retention marketing',
  'loyalty program',
  'shopping cart',
  'checkout flow',
  'product catalog',
  'SKU',
  'POS',
  'point of sale',
  'omnichannel',
  'curbside pickup',
  'inventory turnover',
  // Marketing keywords
  'CTR',
  'CPC',
  'CPM',
  'ROAS',
  'CAC',
  'LTV',
  'MRR',
  'ARR',
  'churn',
  'retention',
  'cohort',
  'attribution',
  'UTM',
  'Google Analytics',
  'Mixpanel',
  'Amplitude',
  'segment',
  'persona',
  'journey map',
  'touchpoint',
  'top-of-funnel',
  'TOFU',
  'MOFU',
  'BOFU',
  'lead generation',
  'lead scoring',
  'nurture',
  'drip campaign',
  // SEO keywords
  'keyword research',
  'meta description',
  'title tag',
  'canonical',
  'sitemap',
  'robots.txt',
  'schema markup',
  'structured data',
  'backlink',
  'domain authority',
  'page authority',
  'SERP',
  'featured snippet',
  'search intent',
  'long-tail keyword',
  'keyword density',
  'alt text',
  'anchor text',
  'internal linking',
  // Project management keywords
  'Gantt chart',
  'critical path',
  'work breakdown',
  'milestone',
  'deliverable',
  'dependency',
  'resource allocation',
  'capacity planning',
  'burn rate',
  'runway',
  'iteration',
  'velocity',
  'story points',
  'fibonacci',
  'planning poker',
  'stand-up',
  'retro',
  'demo',
  'review',
];

export const CREATIVE_WRITING_KEYWORDS = [
  'blog post',
  'article',
  'essay',
  'story',
  'poem',
  'haiku',
  'screenplay',
  'script',
  'dialogue',
  'narrative',
  'character',
  'plot',
  'setting',
  'tone',
  'voice',
  'style',
  'headline',
  'tagline',
  'slogan',
  'copywriting',
  'social media post',
  'caption',
  'newsletter',
  'email campaign',
  'press release',
  'ad copy',
  // Content strategy keywords
  'hook',
  'CTA',
  'call to action',
  'value proposition',
  'elevator pitch',
  'brand voice',
  'tone of voice',
  'style guide',
  'editorial calendar',
  'content pillar',
  'evergreen content',
  'listicle',
  'how-to guide',
  'case study',
  'whitepaper',
  'ebook',
  'infographic script',
  'webinar script',
  'podcast script',
  'video script',
  'storyboard',
  'shot list',
  'B-roll',
];

export const SECURITY_KEYWORDS = [
  'vulnerability',
  'CVE',
  'exploit',
  'penetration test',
  'pentest',
  'XSS',
  'SQL injection',
  'CSRF',
  'SSRF',
  'RCE',
  'buffer overflow',
  'privilege escalation',
  'authentication bypass',
  'OWASP',
  'security audit',
  'threat model',
  'encryption',
  'hashing',
  'firewall',
  'WAF',
  'IDS',
  'IPS',
  'SIEM',
  'SOC',
  'incident response',
  // Advanced security keywords
  'zero-day',
  'supply chain attack',
  'dependency confusion',
  'prototype pollution',
  'deserialization',
  'IDOR',
  'broken access control',
  'mass assignment',
  'API abuse',
  'rate limit bypass',
  'JWT tampering',
  'token replay',
  'session fixation',
  'clickjacking',
  'open redirect',
  'subdomain takeover',
  'DNS rebinding',
  'reverse shell',
  // Threat hunting / forensics / fraud keywords
  'threat hunting',
  'threat intelligence',
  'IOC',
  'YARA rules',
  'MITRE ATT&CK',
  'kill chain',
  'digital forensics',
  'disk imaging',
  'memory forensics',
  'network forensics',
  'malware analysis',
  'reverse engineering',
  'sandbox',
  'decompiler',
  'fraud detection',
  'anomaly detection',
  'behavioral analytics',
  'insider threat',
  'data exfiltration',
  'DLP',
  'SOAR',
  'playbook',
  'EDR',
  'XDR',
  'NDR',
  'UEBA',
  'honeypot',
  'canary token',
  'red team',
  'blue team',
  'purple team',
  'CTF',
  'OSINT',
  'phishing simulation',
  'security awareness',
];

export const MEDICAL_KEYWORDS = [
  'clinical',
  'patient',
  'diagnosis',
  'treatment',
  'symptom',
  'medication',
  'dosage',
  'ICD-10',
  'CPT code',
  'HIPAA',
  'PHI',
  'medical record',
  'lab result',
  'radiology',
  'pathology',
  'prognosis',
  'clinical trial',
  'adverse event',
  'contraindication',
  // Clinical/research keywords
  'EMR',
  'EHR',
  'HL7',
  'FHIR',
  'SNOMED',
  'LOINC',
  'pharmacy',
  'formulary',
  'clinical pathway',
  'evidence-based',
  'systematic review',
  'meta-analysis',
  'randomized controlled trial',
  'double-blind',
  'placebo',
  'biomarker',
  'pharmacokinetics',
  'pharmacodynamics',
  // Epidemiology / public health / telemedicine keywords
  'epidemiology',
  'outbreak investigation',
  'contact tracing',
  'surveillance',
  'public health',
  'population health',
  'telemedicine',
  'telehealth',
  'remote monitoring',
  'pharmacovigilance',
  'drug safety',
  'adverse drug reaction',
  'clinical decision support',
  'care coordination',
  'health informatics',
  'biostatistics',
  'survival analysis',
  'Kaplan-Meier',
  'Cox regression',
  'case fatality rate',
  'incidence rate',
  'prevalence',
  'comorbidity',
  'triage',
  'discharge planning',
  'DRG',
  'revenue cycle',
  'prior authorization',
  'medical coding',
];

export const LEGAL_KEYWORDS = [
  'contract',
  'clause',
  'NDA',
  'liability',
  'indemnification',
  'jurisdiction',
  'statute',
  'case law',
  'precedent',
  'plaintiff',
  'defendant',
  'deposition',
  'discovery',
  'compliance',
  'GDPR',
  'SOC2',
  'regulatory',
  'intellectual property',
  'trademark',
  'patent',
  'copyright',
  // Advanced legal keywords
  'arbitration',
  'mediation',
  'litigation',
  'interrogatory',
  'motion to dismiss',
  'summary judgment',
  'injunction',
  'damages',
  'tort',
  'fiduciary duty',
  'due diligence',
  'escrow',
  'force majeure',
  'indemnity',
  'warranty',
  'representation',
  'covenant',
  'SLA violation',
  // E-discovery / KYC / AML keywords
  'e-discovery',
  'document review',
  'privilege log',
  'redaction',
  'KYC',
  'AML',
  'anti-money laundering',
  'sanctions screening',
  'transaction monitoring',
  'suspicious activity',
  'beneficial ownership',
  'PEP',
  'politically exposed',
  'regulatory filing',
  'regulatory reporting',
  'subpoena',
  'deposition transcript',
  'protective order',
  'Hague convention',
  'choice of law',
  'forum selection',
  'class action',
  'whistleblower protection',
  'FCPA',
  'UK Bribery Act',
];

export const TRANSLATION_KEYWORDS = [
  'translate',
  'translation',
  'localize',
  'localization',
  'i18n',
  'multilingual',
  'language',
  'convert to English',
  'convert to Arabic',
  'convert to Spanish',
  'convert to French',
  'convert to German',
];

export const HR_KEYWORDS = [
  'job description',
  'interview question',
  'screening',
  'onboarding',
  'offboarding',
  'performance review',
  '360 feedback',
  'competency framework',
  'succession planning',
  'talent pipeline',
  'employer branding',
  'EVP',
  'compensation analysis',
  'benefits',
  'equity',
  'vesting',
  'stock options',
  'training module',
  'learning path',
  'assessment rubric',
  // Workforce planning / people analytics keywords
  'workforce planning',
  'workforce analytics',
  'people analytics',
  'attrition analysis',
  'headcount planning',
  'organizational design',
  'job architecture',
  'pay equity',
  'total rewards',
  'employee engagement',
  'pulse survey',
  'exit interview',
  'talent acquisition',
  'sourcing strategy',
  'diversity and inclusion',
  'DEI',
  'employee handbook',
  'labor relations',
  'union negotiation',
  'grievance handling',
  'HRIS',
  'ATS',
  'applicant tracking',
  'background check',
  'reference check',
  'culture fit',
  'employee lifecycle',
  'stay interview',
  'career ladder',
  'competency matrix',
];

export const FINANCE_KEYWORDS = [
  'P&L',
  'balance sheet',
  'cash flow',
  'EBITDA',
  'gross margin',
  'net margin',
  'working capital',
  'accounts receivable',
  'accounts payable',
  'depreciation',
  'amortization',
  'capex',
  'opex',
  'IRR',
  'NPV',
  'DCF',
  'valuation',
  'multiple',
  'comparable',
  'financial model',
  'scenario analysis',
  'sensitivity analysis',
  'monte carlo',
  // Treasury / FP&A / cost accounting keywords
  'treasury',
  'treasury management',
  'FP&A',
  'financial planning',
  'cost accounting',
  'activity-based costing',
  'payroll processing',
  'collections strategy',
  'debt recovery',
  'insurance underwriting',
  'actuarial',
  'claims processing',
  'reinsurance',
  'credit scoring',
  'credit risk',
  'market risk',
  'operational risk',
  'Basel III',
  'Solvency II',
  'stress testing',
  'value at risk',
  'VaR',
  'hedge fund',
  'portfolio management',
  'asset allocation',
  'fixed income',
  'derivatives',
  'options pricing',
  'Black-Scholes',
  'swap',
  'futures',
  'yield curve',
  'duration',
  'convexity',
  'Sharpe ratio',
  'alpha',
  'beta',
  'volatility',
  'drawdown',
  'Sortino ratio',
  'Treynor ratio',
];

export const OPERATIONS_KEYWORDS = [
  'supply chain',
  'inventory management',
  'just-in-time',
  'kanban',
  'lean',
  'six sigma',
  'DMAIC',
  'process mapping',
  'bottleneck',
  'throughput',
  'cycle time',
  'lead time',
  'SOP',
  'vendor management',
  'RFQ',
  'procurement',
  'sourcing',
  'contract negotiation',
  'total cost of ownership',
];

export const SALES_KEYWORDS = [
  'demo',
  'proof of concept',
  'POC',
  'pilot',
  'trial',
  'churn risk',
  'health score',
  'NPS',
  'CSAT',
  'CES',
  'ticket',
  'escalation',
  'first response time',
  'resolution time',
  'knowledge base',
  'FAQ',
  'playbook',
  'battle card',
  'objection handling',
  'competitive positioning',
];

export const REAL_ESTATE_KEYWORDS = [
  'property',
  'mortgage',
  'appraisal',
  'zoning',
  'title',
  'escrow',
  'closing',
  'deed',
  'lien',
  'HOA',
  'comps',
  'square footage',
  'cap rate',
  'NOI',
  'cash-on-cash',
];

export const EDUCATION_KEYWORDS = [
  'curriculum',
  'syllabus',
  'lesson plan',
  'learning objective',
  'assessment',
  'rubric',
  'pedagogy',
  'andragogy',
  'blended learning',
  'e-learning',
  'LMS',
  'SCORM',
  'Bloom taxonomy',
  'instructional design',
  'microlearning',
];

export const CUSTOMER_SUPPORT_KEYWORDS = [
  'ticket',
  'helpdesk',
  'FAQ',
  'knowledge base',
  'escalation',
  'first response',
  'resolution time',
  'CSAT',
  'CES',
  'NPS',
  'chatbot',
  'self-service',
  'SLA breach',
  'macros',
  'canned response',
];

export const VIDEO_AUDIO_KEYWORDS = [
  'video script',
  'storyboard',
  'shot list',
  'timeline',
  'editing',
  'premiere',
  'davinci resolve',
  'after effects',
  'keyframe',
  'transition',
  'voiceover',
  'narration',
  'subtitle',
  'caption',
  'sound design',
];

export const DESIGN_KEYWORDS = [
  'wireframe',
  'mockup',
  'prototype',
  'Figma',
  'Sketch',
  'Adobe XD',
  'design system',
  'component library',
  'typography',
  'color palette',
  'brand guidelines',
  'logo design',
  'UI kit',
  'responsive design',
  'dark mode',
];

export const RESEARCH_KEYWORDS = [
  'literature review',
  'hypothesis',
  'methodology',
  'sampling',
  'survey design',
  'qualitative',
  'quantitative',
  'thematic analysis',
  'grounded theory',
  'ethnography',
  'longitudinal',
  'cross-sectional',
  'peer review',
  'publication',
  'abstract',
];

export const EXECUTIVE_KEYWORDS = [
  'board meeting',
  'shareholder',
  'quarterly earnings',
  'annual report',
  'corporate governance',
  'succession planning',
  'M&A',
  'acquisition',
  'divestiture',
  'IPO',
];

export const PRIVACY_KEYWORDS = [
  'medical',
  'patient',
  'diagnosis',
  'health record',
  'PHI',
  'HIPAA',
  'tax return',
  'salary',
  'SSN',
  'social security',
  'credit card',
  'bank account',
  'password',
  'private key',
  'secret',
  'confidential',
  'NDA',
  'attorney-client',
  'privilege',
  'personal data',
  'PII',
  'financial statement',
  'investment portfolio',
  'insurance claim',
  'disability',
  'mental health',
  'therapy',
  'counseling',
  'genetic',
  'criminal record',
  'employment contract',
  'credit report',
  'prenuptial',
  'personal spending',
  'divorce',
  'custody',
  'alimony',
  'mortgage application',
  'bankruptcy',
  'loan application',
  'background check',
  'drug test',
  'performance review',
  'termination',
  'severance',
  'whistleblower',
  'harassment',
  'discrimination',
  // Finance privacy keywords
  'tax return',
  'financial statement',
  'investment portfolio',
  'net worth',
  'stock portfolio',
  'trading account',
  'brokerage',
  'wire transfer',
  'routing number',
  'account number',
  // HR privacy keywords
  'employee record',
  'personnel file',
  'disciplinary action',
  'grievance',
  'workplace complaint',
  'salary negotiation',
  'offer letter',
  'severance package',
  // Real estate privacy keywords
  'mortgage application',
  'property deed',
  'title search',
  'closing disclosure',
  'settlement statement',
  // Additional privacy keywords from experiment misses
  'board compensation',
  'executive compensation',
  'collections recovery',
  'Basel capital',
  'IP portfolio',
  'defense mission',
  'classified intelligence',
  // Additional privacy from experiment round 2 misses
  'stock option',
  'vesting schedule',
  'credit history',
  'loan approval',
  'antitrust',
  'classified briefing',
  'board of directors',
  'meeting minutes',
  'retirement plan',
  'retirement distribution',
  'pension',
  'individual retirement',
  'disciplinary record',
  'student record',
  'FERPA',
  'juvenile record',
  'adoption record',
  'immigration status',
  'visa application',
  'asylum',
  'deportation',
  'net worth statement',
  'personal finance',
  'personal wealth',
  'estate planning',
  'trust fund',
  'beneficiary',
  'power of attorney',
  'guardianship',
  'conservatorship',
  'competency hearing',
  'involuntary commitment',
  'restraining order',
  'protective order',
  'domestic violence',
  'sexual harassment',
  'workplace misconduct',
  'internal audit',
  'embezzlement',
  'insider trading',
  'bribery investigation',
  'kickback scheme',
];

export const ENGINEERING_KEYWORDS = [
  // CAD / CAM / mechanical keywords
  'CAD',
  'CAM',
  'FEA',
  'CFD',
  'SolidWorks',
  'AutoCAD',
  'CATIA',
  'tolerance analysis',
  'GD&T',
  'materials science',
  'structural analysis',
  'thermodynamics',
  'fluid dynamics',
  'aerodynamics',
  'powertrain',
  'drivetrain',
  'suspension',
  'chassis',
  'avionics',
  'flight control',
  'propulsion',
  'naval architecture',
  'hull design',
  'marine propulsion',
  // Civil engineering keywords
  'structural engineering',
  'geotechnical',
  'foundation design',
  'reinforced concrete',
  'steel structure',
  'seismic analysis',
  'wind load',
  'dead load',
  'live load',
  'beam design',
  'column design',
  'retaining wall',
  'earthwork',
  'grading plan',
  'stormwater',
  'drainage',
  'pavement design',
  'traffic engineering',
  'highway design',
  'bridge design',
  'tunnel engineering',
  // Electrical engineering keywords
  'circuit design',
  'PCB',
  'schematic',
  'SPICE',
  'signal processing',
  'power electronics',
  'transformer',
  'inverter',
  'rectifier',
  'motor control',
  'PID controller',
  'control system',
  'feedback loop',
  'Bode plot',
  'Nyquist',
  'root locus',
  'state space',
  'transfer function',
  // Manufacturing keywords
  'CNC',
  'machining',
  'injection molding',
  'casting',
  'forging',
  'welding',
  '3D printing',
  'additive manufacturing',
  'subtractive manufacturing',
  'bill of materials',
  'BOM',
  'work instruction',
  'process capability',
  'Cpk',
  'FMEA',
  'DFMEA',
  'PFMEA',
  'APQP',
  'PPAP',
  'first article inspection',
  // Automotive keywords
  'ADAS',
  'autonomous driving',
  'V2X',
  'OBD-II',
  'emissions testing',
  'crash simulation',
  'NVH',
  'noise vibration harshness',
  'ECU',
  'vehicle dynamics',
  // Aerospace keywords
  'wind tunnel',
  'Mach number',
  'Reynolds number',
  'drag coefficient',
  'lift coefficient',
  'orbital mechanics',
  'trajectory',
  'payload',
  'thrust-to-weight',
  'composite materials',
];

export const SCIENCE_KEYWORDS = [
  // Chemistry keywords
  'spectroscopy',
  'chromatography',
  'titration',
  'synthesis',
  'reaction kinetics',
  'molecular dynamics',
  'organic chemistry',
  'inorganic chemistry',
  'analytical chemistry',
  'physical chemistry',
  'polymer',
  'catalyst',
  'electrochemistry',
  'redox reaction',
  'stoichiometry',
  'molarity',
  'pH',
  'buffer solution',
  'crystallography',
  // Biology keywords
  'protein folding',
  'gene expression',
  'cell culture',
  'microscopy',
  'PCR',
  'gel electrophoresis',
  'CRISPR',
  'gene editing',
  'plasmid',
  'cloning',
  'transfection',
  'Western blot',
  'ELISA',
  'flow cytometry',
  'immunohistochemistry',
  'in vitro',
  'in vivo',
  'stem cell',
  'differentiation',
  'apoptosis',
  'mitosis',
  'meiosis',
  'biodiversity',
  'ecology',
  'ecosystem',
  'food web',
  'trophic level',
  // Physics keywords
  'quantum mechanics',
  'relativity',
  'particle physics',
  'cosmology',
  'astrophysics',
  'Schrodinger equation',
  'wave function',
  'Hamiltonian',
  'Lagrangian',
  'Maxwell equations',
  'electromagnetic',
  'optics',
  'photonics',
  'semiconductor',
  'superconductor',
  'quantum computing',
  'qubit',
  'entanglement',
  'decoherence',
  'Feynman diagram',
  'standard model',
  'dark matter',
  'dark energy',
  'gravitational wave',
  // Environmental / climate keywords
  'climate modeling',
  'atmospheric science',
  'carbon footprint',
  'lifecycle assessment',
  'environmental impact',
  'greenhouse gas',
  'radiative forcing',
  'albedo',
  'ocean acidification',
  'permafrost',
  'coral reef',
  'deforestation',
  'desertification',
  'soil science',
  'hydrology',
  'watershed',
  'aquifer',
  'groundwater',
  // Mathematics keywords
  'topology',
  'abstract algebra',
  'number theory',
  'combinatorics',
  'graph theory',
  'differential equation',
  'partial differential',
  'Fourier transform',
  'Laplace transform',
  'eigenvalue',
  'eigenvector',
  'linear algebra',
  'real analysis',
  'complex analysis',
  'functional analysis',
  'measure theory',
  'stochastic process',
  'Markov chain',
  'Monte Carlo simulation',
  'numerical methods',
  'finite element',
  'finite difference',
];

export const GOVERNMENT_KEYWORDS = [
  'government procurement',
  'public sector',
  'civil service',
  'legislation',
  'regulatory impact',
  'policy brief',
  'constituent services',
  'municipal',
  'county',
  'federal',
  'state budget',
  'appropriations',
  'FOIA',
  'public records',
  'classification',
  'clearance',
  'intelligence analysis',
  'OSINT',
  'SIGINT',
  'HUMINT',
  'GEOINT',
  'national security',
  'defense procurement',
  'military logistics',
  'force structure',
  'readiness',
  'joint operations',
  'rules of engagement',
  'acquisition lifecycle',
  'FAR',
  'DFARS',
  'cost-plus contract',
  'fixed-price contract',
  'IDIQ',
  'task order',
  'past performance',
  'source selection',
  'small business set-aside',
  'security clearance',
  'TS/SCI',
  'compartmented',
  'need to know',
  'counterintelligence',
  'cyber command',
  'information warfare',
  'public diplomacy',
  'foreign policy',
  'treaty',
  'bilateral agreement',
  'sanctions',
  'embargo',
  'tariff',
  'trade agreement',
  'customs regulation',
  'immigration policy',
  'asylum',
  'visa adjudication',
  'border security',
  'election administration',
  'redistricting',
  'gerrymandering',
  'census',
  'public comment',
  'rulemaking',
  'notice of proposed rulemaking',
  'NPRM',
  'Federal Register',
  'GAO',
  'inspector general',
  'oversight',
  'accountability',
  'public policy',
  'defense mission',
  'election',
  'satellite',
  'diplomat',
  'embassy',
  'treaty',
  'sanction',
  'border security',
  'immigration policy',
  'census',
  'congressional',
  'parliament',
];

export const LOGISTICS_KEYWORDS = [
  'freight forwarding',
  'bill of lading',
  'customs clearance',
  'incoterms',
  'harmonized code',
  'tariff classification',
  'bonded warehouse',
  'cross-docking',
  'last mile delivery',
  'route optimization',
  'fleet management',
  'telematics',
  'fleet tracking',
  'driver scheduling',
  'load planning',
  'backhaul optimization',
  'cold chain',
  'temperature control',
  'hazardous materials',
  'HAZMAT',
  'dangerous goods',
  'shipping container',
  'TEU',
  'FTL',
  'LTL',
  'intermodal',
  'transshipment',
  'demurrage',
  'detention',
  'proof of delivery',
  'warehouse management',
  'WMS',
  'pick and pack',
  'put-away',
  'slotting',
  'cycle counting',
  'safety stock',
  'reorder point',
  'economic order quantity',
  'EOQ',
  'ABC analysis',
  'landed cost',
  'duty drawback',
  'free trade zone',
  'FTZ',
  'letter of credit',
  'trade finance',
  'export control',
  'ITAR',
  'EAR',
  'denied party screening',
];

export const HOSPITALITY_KEYWORDS = [
  'hotel revenue management',
  'RevPAR',
  'ADR',
  'occupancy rate',
  'guest satisfaction',
  'restaurant operations',
  'food cost',
  'labor cost',
  'menu engineering',
  'banquet operations',
  'event planning',
  'conference management',
  'venue booking',
  'catering',
  'travel itinerary',
  'flight booking',
  'visa processing',
  'concierge',
  'front desk',
  'housekeeping',
  'turnover time',
  'reservation system',
  'yield management',
  'group booking',
  'room block',
  'comp set',
  'star rating',
  'TripAdvisor',
  'online reputation',
  'guest review',
  'upselling',
  'cross-selling',
  'loyalty tier',
  'points program',
  'frequent flyer',
  'mileage',
  'lounge access',
  'tour operator',
  'destination management',
  'DMC',
  'inbound tourism',
  'outbound tourism',
  'cruise operations',
  'shore excursion',
  'food safety',
  'HACCP',
  'ServSafe',
  'allergen management',
  'wine pairing',
  'sommelier',
  'bar inventory',
  'beverage cost',
];

export const MEDIA_KEYWORDS = [
  'news writing',
  'AP style',
  'editorial',
  'breaking news',
  'investigative journalism',
  'fact-checking',
  'source verification',
  'editorial calendar',
  'publishing workflow',
  'manuscript',
  'galley proof',
  'ISBN',
  'peer review',
  'broadcasting',
  'live production',
  'newsroom',
  'wire service',
  'syndication',
  'paywall',
  'subscriber analytics',
  'circulation',
  'readership',
  'audience metrics',
  'Nielsen ratings',
  'impressions',
  'reach',
  'frequency',
  'programmatic advertising',
  'ad server',
  'ad exchange',
  'DSP',
  'SSP',
  'header bidding',
  'viewability',
  'brand safety',
  'content moderation',
  'community guidelines',
  'takedown notice',
  'DMCA',
  'rights management',
  'digital rights',
  'DRM',
  'royalty',
  'licensing',
  'syndication rights',
  'reprint rights',
  'press pass',
  'media accreditation',
  'press conference',
  'media kit',
  'embargo',
  'off the record',
  'on background',
  'attribution',
];

export const SUSTAINABILITY_KEYWORDS = [
  'ESG reporting',
  'carbon emissions',
  'scope 1 2 3',
  'sustainability report',
  'GRI standards',
  'TCFD',
  'net zero',
  'carbon offset',
  'renewable energy certificate',
  'circular economy',
  'waste reduction',
  'water footprint',
  'biodiversity',
  'environmental audit',
  'green building',
  'LEED',
  'BREEAM',
  'carbon credit',
  'emissions trading',
  'cap and trade',
  'science-based targets',
  'SBTi',
  'climate disclosure',
  'CDP',
  'sustainable finance',
  'green bond',
  'impact investing',
  'responsible investing',
  'ESG score',
  'materiality assessment',
  'stakeholder engagement',
  'double materiality',
  'Scope 1',
  'Scope 2',
  'Scope 3',
  'value chain emissions',
  'decarbonization',
  'electrification',
  'hydrogen economy',
  'carbon capture',
  'CCS',
  'CCUS',
  'regenerative agriculture',
  'sustainable supply chain',
  'ethical sourcing',
  'fair trade',
  'social impact',
  'social license',
  'just transition',
  'energy efficiency',
  'green procurement',
  'zero waste',
  'lifecycle analysis',
  'environmental management system',
  'ISO 14001',
];

export const CATEGORY_TO_ROLE_MAP: Record<string, LocalModelRole> = {
  coding: LocalModelRole.LOCAL_CODING,
  reasoning: LocalModelRole.LOCAL_REASONING,
  thinking: LocalModelRole.LOCAL_THINKING,
  chat: LocalModelRole.LOCAL_FALLBACK_CHAT,
  'image-generation': LocalModelRole.LOCAL_IMAGE_GENERATION,
  'file-generation': LocalModelRole.LOCAL_FILE_GENERATION,
  infrastructure: LocalModelRole.LOCAL_CODING,
  'data-analysis': LocalModelRole.LOCAL_REASONING,
  business: LocalModelRole.LOCAL_FILE_GENERATION,
  'creative-writing': LocalModelRole.LOCAL_FALLBACK_CHAT,
  security: LocalModelRole.LOCAL_CODING,
  medical: LocalModelRole.LOCAL_REASONING,
  legal: LocalModelRole.LOCAL_REASONING,
  translation: LocalModelRole.LOCAL_FALLBACK_CHAT,
  hr: LocalModelRole.LOCAL_FALLBACK_CHAT,
  finance: LocalModelRole.LOCAL_REASONING,
  operations: LocalModelRole.LOCAL_FILE_GENERATION,
  sales: LocalModelRole.LOCAL_FALLBACK_CHAT,
  'real-estate': LocalModelRole.LOCAL_REASONING,
  education: LocalModelRole.LOCAL_FALLBACK_CHAT,
  'customer-support': LocalModelRole.LOCAL_FALLBACK_CHAT,
  'video-audio': LocalModelRole.LOCAL_FALLBACK_CHAT,
  design: LocalModelRole.LOCAL_FALLBACK_CHAT,
  research: LocalModelRole.LOCAL_REASONING,
  executive: LocalModelRole.LOCAL_REASONING,
  engineering: LocalModelRole.LOCAL_REASONING,
  science: LocalModelRole.LOCAL_REASONING,
  government: LocalModelRole.LOCAL_REASONING,
  logistics: LocalModelRole.LOCAL_FALLBACK_CHAT,
  hospitality: LocalModelRole.LOCAL_FALLBACK_CHAT,
  media: LocalModelRole.LOCAL_FALLBACK_CHAT,
  sustainability: LocalModelRole.LOCAL_FALLBACK_CHAT,
};

export const CONFIDENCE_EXACT_KEYWORD = 0.95;
export const CONFIDENCE_VERB_NOUN_COMBO = 0.9;
export const CONFIDENCE_CATEGORY_KEYWORD = 0.85;
export const CONFIDENCE_HEURISTIC_FALLBACK = 0.6;
export const CONFIDENCE_PRIVACY_ENFORCED = 0.95;

export const PROMPT_CACHE_TTL_MS = 5 * 60 * 1000;

export const PROVIDER_COST_PER_1M_TOKENS: Record<string, { input: number; output: number }> = {
  'local-ollama': { input: 0, output: 0 },
  ANTHROPIC: { input: 3.0, output: 15.0 },
  OPENAI: { input: 0.15, output: 0.6 },
  GEMINI: { input: 0.075, output: 0.3 },
  DEEPSEEK: { input: 0.14, output: 0.28 },
  GROK: { input: 3.0, output: 15.0 },
};

export const COST_CLASS_THRESHOLDS = {
  free: 0,
  low: 0.5,
  medium: 5.0,
  high: 15.0,
};

export const CATEGORY_LATENCY_SLA_MS: Record<string, number> = {
  coding: 5000,
  reasoning: 10000,
  image_generation: 30000,
  file_generation: 15000,
  general: 3000,
  translation: 3000,
  customer_support: 2000,
  security: 5000,
  medical: 5000,
  legal: 5000,
  finance: 5000,
  business: 3000,
  creative_writing: 5000,
  data_analysis: 8000,
  infrastructure: 5000,
  hr: 3000,
  operations: 3000,
  sales: 2000,
  education: 3000,
  design: 5000,
  research: 10000,
  executive: 3000,
  engineering: 8000,
  science: 10000,
  government: 5000,
  logistics: 3000,
  hospitality: 3000,
  media: 3000,
  sustainability: 5000,
  video_audio: 10000,
  real_estate: 3000,
  thinking: 10000,
};

export const MULTI_INTENT_PRIORITY: Record<string, number> = {
  medical: 1,
  legal: 1,
  finance: 1,
  government: 1,
  executive: 1,
  security: 2,
  engineering: 2,
  science: 2,
  coding: 3,
  infrastructure: 3,
  data_analysis: 3,
  reasoning: 3,
  thinking: 3,
  creative_writing: 4,
  business: 4,
  operations: 4,
  hr: 4,
  sales: 4,
  education: 5,
  customer_support: 5,
  design: 5,
  media: 5,
  hospitality: 5,
  logistics: 5,
  sustainability: 5,
  translation: 5,
  real_estate: 5,
  video_audio: 5,
  research: 3,
  general: 6,
};

export const MULTI_INTENT_CONFIDENCE_SINGLE = 0.95;
export const MULTI_INTENT_CONFIDENCE_DOUBLE = 0.85;
export const MULTI_INTENT_CONFIDENCE_MULTI = 0.75;
