import type { CatalogNodeEntry } from '../workflow-node-catalog'

export const AI_NEW_NODES: CatalogNodeEntry[] = [
  {
    type: 'lens_execute',
    label: 'Lens Execute',
    description: 'Execute a specific Lens by ID with full prompt and model configuration.',
    category: 'ai_primitive',
    color: 'text-fuchsia-500',
    iconName: 'Sparkles',
    inputs: [{ name: 'prompt', type: 'text', required: true, description: 'Prompt to send to the Lens' }],
    outputs: [
      { name: 'text', type: 'text', description: 'Generated text output' },
      { name: 'result', type: 'lens_result', description: 'Full Lens execution result with metadata' },
    ],
    requiredConfig: ['lensId', 'model_id'],
    optionalConfig: ['temperature', 'maxTokens', 'fundingSource'],
    exampleConfig: {
      lensId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
      model_id: 'claude-sonnet-4-6',
      temperature: '0.7',
      maxTokens: '2048',
      fundingSource: 'platform',
    },
    acceptsInputTypes: ['text', 'json', 'any'],
    producesOutputType: 'lens_result',
    n8nEquivalent: 'n8n-nodes-base.openAi',
    docsPath: '/en/explanation/lenses/execution',
  },
  {
    type: 'agent_execute',
    label: 'Agent Execute',
    description: 'Run an autonomous AI agent with tools, memory, and multi-step reasoning.',
    category: 'ai_primitive',
    color: 'text-fuchsia-500',
    iconName: 'Bot',
    inputs: [{ name: 'task', type: 'text', required: true, description: 'Agent task description' }],
    outputs: [
      { name: 'result', type: 'agent_result', description: 'Agent final output and trace' },
      { name: 'steps', type: 'array', description: 'Agent execution step log' },
    ],
    requiredConfig: ['agentLensId', 'model_id'],
    optionalConfig: ['maxSteps', 'tools', 'memoryKey', 'temperature'],
    exampleConfig: {
      agentLensId: 'b2c3d4e5-f6a7-8901-bcde-f12345678901',
      model_id: 'claude-opus-4-6',
      maxSteps: 10,
      tools: ['web_search', 'code_interpreter'],
      memoryKey: 'agent_session',
    },
    acceptsInputTypes: ['text', 'json', 'any'],
    producesOutputType: 'agent_result',
    n8nEquivalent: '@n8n/n8n-nodes-langchain.agent',
    docsPath: '/en/explanation/agents/execution',
  },
  {
    type: 'vector_search',
    label: 'Vector Search',
    description: 'Search a vector store using embedding similarity for nearest neighbors.',
    category: 'ai_primitive',
    color: 'text-fuchsia-500',
    iconName: 'Radar',
    inputs: [{ name: 'query', type: 'embedding', required: true, description: 'Query embedding vector' }],
    outputs: [
      { name: 'results', type: 'document[]', description: 'Matching documents with similarity scores' },
    ],
    requiredConfig: ['collection'],
    optionalConfig: ['topK', 'minScore', 'filter', 'includeMetadata'],
    exampleConfig: {
      collection: 'lenser_knowledge_base',
      topK: 5,
      minScore: 0.75,
      filter: { category: 'documentation' },
      includeMetadata: true,
    },
    acceptsInputTypes: ['embedding', 'array', 'text'],
    producesOutputType: 'document[]',
    n8nEquivalent: '@n8n/n8n-nodes-langchain.vectorStoreRetriever',
  },
  {
    type: 'summarizer',
    label: 'Summarizer',
    description: 'Generate a concise summary of input text using configurable strategy (map-reduce, refine, stuff).',
    category: 'ai_primitive',
    color: 'text-fuchsia-500',
    iconName: 'FileDown',
    inputs: [{ name: 'text', type: 'text', required: true, description: 'Text or documents to summarize' }],
    outputs: [{ name: 'summary', type: 'text', description: 'Generated summary' }],
    requiredConfig: ['model_id'],
    optionalConfig: ['strategy', 'maxLength', 'language', 'focusAreas'],
    exampleConfig: {
      model_id: 'claude-sonnet-4-6',
      strategy: 'map_reduce',
      maxLength: 500,
      language: 'en',
      focusAreas: 'key findings, action items',
    },
    acceptsInputTypes: ['text', 'document[]', 'any'],
    producesOutputType: 'text',
    n8nEquivalent: '@n8n/n8n-nodes-langchain.chainSummarization',
  },
  {
    type: 'classifier',
    label: 'Classifier',
    description: 'Classify input text into one of the defined categories using an LLM.',
    category: 'ai_primitive',
    color: 'text-fuchsia-500',
    iconName: 'Tags',
    inputs: [{ name: 'text', type: 'text', required: true, description: 'Text to classify' }],
    outputs: [
      { name: 'category', type: 'text', description: 'Predicted category label' },
      { name: 'confidence', type: 'number', description: 'Classification confidence 0-1' },
      { name: 'result', type: 'json', description: 'Full classification result with all scores' },
    ],
    requiredConfig: ['categories', 'model_id'],
    optionalConfig: ['examples', 'multiLabel', 'threshold'],
    exampleConfig: {
      categories: ['bug_report', 'feature_request', 'question', 'praise'],
      model_id: 'claude-haiku-4-5',
      examples: [{ text: 'The app crashes on login', label: 'bug_report' }],
      multiLabel: false,
      threshold: 0.6,
    },
    acceptsInputTypes: ['text', 'any'],
    producesOutputType: 'json',
    n8nEquivalent: '@n8n/n8n-nodes-langchain.textClassifier',
  },
  {
    type: 'translator',
    label: 'Translator',
    description: 'Translate text between languages using an AI model.',
    category: 'ai_primitive',
    color: 'text-fuchsia-500',
    iconName: 'Languages',
    inputs: [{ name: 'text', type: 'text', required: true, description: 'Text to translate' }],
    outputs: [
      { name: 'translated', type: 'text', description: 'Translated text' },
      { name: 'detectedLanguage', type: 'text', description: 'Detected source language code' },
    ],
    requiredConfig: ['targetLanguage', 'model_id'],
    optionalConfig: ['sourceLanguage', 'preserveFormatting', 'glossary'],
    exampleConfig: {
      targetLanguage: 'tr',
      model_id: 'claude-sonnet-4-6',
      sourceLanguage: 'en',
      preserveFormatting: true,
    },
    acceptsInputTypes: ['text', 'any'],
    producesOutputType: 'text',
  },
  {
    type: 'image_analyze',
    label: 'Image Analyze',
    description: 'Analyze an image using a multimodal AI model to extract descriptions, objects, or structured data.',
    category: 'ai_primitive',
    color: 'text-fuchsia-500',
    iconName: 'ScanEye',
    inputs: [{ name: 'image', type: 'image', required: true, description: 'Image URL or binary' }],
    outputs: [
      { name: 'analysis', type: 'json', description: 'Structured analysis result' },
      { name: 'description', type: 'text', description: 'Natural language description' },
    ],
    requiredConfig: ['model_id'],
    optionalConfig: ['prompt', 'outputFormat', 'detailLevel'],
    exampleConfig: {
      model_id: 'claude-sonnet-4-6',
      prompt: 'Describe the artistic style and composition of this battle submission',
      outputFormat: 'json',
      detailLevel: 'detailed',
    },
    acceptsInputTypes: ['image', 'text', 'binary'],
    producesOutputType: 'json',
    n8nEquivalent: 'n8n-nodes-base.openAi',
  },
  {
    type: 'audio_transcribe',
    label: 'Audio Transcribe',
    description: 'Transcribe audio to text using a speech-to-text provider.',
    category: 'ai_primitive',
    color: 'text-fuchsia-500',
    iconName: 'AudioLines',
    inputs: [{ name: 'audio', type: 'audio', required: true, description: 'Audio file URL or binary' }],
    outputs: [
      { name: 'text', type: 'text', description: 'Transcribed text' },
      { name: 'segments', type: 'array', description: 'Timestamped segments' },
    ],
    requiredConfig: ['provider'],
    optionalConfig: ['language', 'model', 'timestamps'],
    exampleConfig: {
      provider: 'openai',
      model: 'whisper-1',
      language: 'en',
      timestamps: true,
    },
    acceptsInputTypes: ['audio', 'file', 'binary'],
    producesOutputType: 'text',
  },
  {
    type: 'video_analyze',
    label: 'Video Analyze',
    description: 'Analyze video content by extracting key frames and running multimodal analysis.',
    category: 'ai_primitive',
    color: 'text-fuchsia-500',
    iconName: 'Video',
    inputs: [{ name: 'video', type: 'video', required: true, description: 'Video URL or binary' }],
    outputs: [
      { name: 'analysis', type: 'json', description: 'Frame-by-frame analysis results' },
      { name: 'summary', type: 'text', description: 'Overall video summary' },
    ],
    requiredConfig: ['model_id'],
    optionalConfig: ['frameInterval', 'maxFrames', 'prompt'],
    exampleConfig: {
      model_id: 'claude-sonnet-4-6',
      frameInterval: 5,
      maxFrames: 20,
      prompt: 'Describe the key moments and visual quality of this battle video submission',
    },
    acceptsInputTypes: ['video', 'file', 'binary'],
    producesOutputType: 'json',
  },
]
