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

export const MEDIA_NODES: CatalogNodeEntry[] = [
  {
    type: 'text_to_image',
    label: 'Text to Image',
    description: 'Generate an image from a text prompt using an image generation provider.',
    category: 'media',
    color: 'text-indigo-500',
    iconName: 'ImagePlus',
    inputs: [{ name: 'prompt', type: 'text', required: true, description: 'Image generation prompt' }],
    outputs: [
      { name: 'image', type: 'image', description: 'Generated image URL' },
      { name: 'metadata', type: 'json', description: 'Generation metadata (seed, dimensions, model)' },
    ],
    requiredConfig: ['provider', 'model'],
    optionalConfig: ['width', 'height', 'negativePrompt', 'seed', 'steps', 'guidanceScale'],
    exampleConfig: {
      provider: 'fal-ai',
      model: 'fal-ai/flux-pro/v1.1',
      width: 1024,
      height: 1024,
      negativePrompt: 'blurry, low quality',
      steps: 30,
      guidanceScale: 7.5,
    },
    acceptsInputTypes: ['text', 'any'],
    producesOutputType: 'image',
    n8nEquivalent: 'n8n-nodes-base.openAi',
    docsPath: '/en/explanation/media/generation',
  },
  {
    type: 'image_to_image',
    label: 'Image to Image',
    description: 'Transform an existing image using a prompt and style transfer.',
    category: 'media',
    color: 'text-indigo-500',
    iconName: 'ImageDown',
    inputs: [
      { name: 'image', type: 'image', required: true, description: 'Source image URL' },
      { name: 'prompt', type: 'text', required: true, description: 'Transformation prompt' },
    ],
    outputs: [
      { name: 'image', type: 'image', description: 'Transformed image URL' },
      { name: 'metadata', type: 'json', description: 'Transformation metadata' },
    ],
    requiredConfig: ['provider', 'model'],
    optionalConfig: ['strength', 'seed', 'negativePrompt'],
    exampleConfig: {
      provider: 'fal-ai',
      model: 'fal-ai/flux-pro/v1.1/redux',
      strength: 0.7,
      seed: 42,
    },
    acceptsInputTypes: ['image', 'text', 'any'],
    producesOutputType: 'image',
  },
  {
    type: 'image_to_audio',
    label: 'Image to Audio',
    description: 'Generate audio description or sonification from an image.',
    category: 'media',
    color: 'text-indigo-500',
    iconName: 'AudioWaveform',
    inputs: [{ name: 'image', type: 'image', required: true, description: 'Source image URL' }],
    outputs: [
      { name: 'audio', type: 'audio', description: 'Generated audio URL' },
      { name: 'metadata', type: 'json', description: 'Audio metadata (duration, format)' },
    ],
    requiredConfig: ['provider', 'model'],
    optionalConfig: ['style', 'duration', 'language'],
    exampleConfig: {
      provider: 'fal-ai',
      model: 'fal-ai/image-to-audio',
      style: 'descriptive_narration',
      duration: 30,
      language: 'en',
    },
    acceptsInputTypes: ['image', 'binary', 'any'],
    producesOutputType: 'audio',
  },
  {
    type: 'text_to_speech',
    label: 'Text to Speech',
    description: 'Convert text to spoken audio using a TTS provider.',
    category: 'media',
    color: 'text-indigo-500',
    iconName: 'Volume2',
    inputs: [{ name: 'text', type: 'text', required: true, description: 'Text to convert to speech' }],
    outputs: [
      { name: 'audio', type: 'audio', description: 'Generated audio URL' },
      { name: 'metadata', type: 'json', description: 'Audio metadata (duration, format, voice)' },
    ],
    requiredConfig: ['provider', 'voice'],
    optionalConfig: ['model', 'speed', 'language', 'outputFormat'],
    exampleConfig: {
      provider: 'openai',
      voice: 'alloy',
      model: 'tts-1-hd',
      speed: 1.0,
      outputFormat: 'mp3',
    },
    acceptsInputTypes: ['text', 'any'],
    producesOutputType: 'audio',
  },
  {
    type: 'speech_to_text',
    label: 'Speech to Text',
    description: 'Transcribe spoken audio to text with timestamp support.',
    category: 'media',
    color: 'text-indigo-500',
    iconName: 'Mic',
    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 word/sentence segments' },
    ],
    requiredConfig: ['provider'],
    optionalConfig: ['model', 'language', 'timestamps', 'diarize'],
    exampleConfig: {
      provider: 'openai',
      model: 'whisper-1',
      language: 'en',
      timestamps: true,
      diarize: false,
    },
    acceptsInputTypes: ['audio', 'file', 'binary'],
    producesOutputType: 'text',
  },
  {
    type: 'text_to_video',
    label: 'Text to Video',
    description: 'Generate a video from a text prompt using a video generation provider.',
    category: 'media',
    color: 'text-indigo-500',
    iconName: 'Clapperboard',
    inputs: [{ name: 'prompt', type: 'text', required: true, description: 'Video generation prompt' }],
    outputs: [
      { name: 'video', type: 'video', description: 'Generated video URL' },
      { name: 'metadata', type: 'json', description: 'Video metadata (duration, resolution, fps)' },
    ],
    requiredConfig: ['provider', 'model'],
    optionalConfig: ['duration', 'aspectRatio', 'fps', 'seed'],
    exampleConfig: {
      provider: 'fal-ai',
      model: 'fal-ai/minimax-video',
      duration: 5,
      aspectRatio: '16:9',
      fps: 24,
    },
    acceptsInputTypes: ['text', 'any'],
    producesOutputType: 'video',
  },
  {
    type: 'image_upscale',
    label: 'Image Upscale',
    description: 'Upscale an image to higher resolution using an AI model.',
    category: 'media',
    color: 'text-indigo-500',
    iconName: 'Maximize2',
    inputs: [{ name: 'image', type: 'image', required: true, description: 'Source image URL' }],
    outputs: [
      { name: 'image', type: 'image', description: 'Upscaled image URL' },
      { name: 'metadata', type: 'json', description: 'Output dimensions and scale factor' },
    ],
    requiredConfig: ['provider', 'scale'],
    optionalConfig: ['model', 'outputFormat'],
    exampleConfig: {
      provider: 'fal-ai',
      scale: 4,
      model: 'fal-ai/real-esrgan',
      outputFormat: 'png',
    },
    acceptsInputTypes: ['image', 'binary', 'any'],
    producesOutputType: 'image',
  },
  {
    type: 'media_convert',
    label: 'Media Convert',
    description: 'Convert media between formats (image, audio, video) with optional quality settings.',
    category: 'media',
    color: 'text-indigo-500',
    iconName: 'RefreshCw',
    inputs: [{ name: 'input', type: 'file', required: true, description: 'Source media file' }],
    outputs: [
      { name: 'output', type: 'file', description: 'Converted media file URL' },
      { name: 'metadata', type: 'json', description: 'Output format, size, and duration' },
    ],
    requiredConfig: ['outputFormat'],
    optionalConfig: ['quality', 'codec', 'bitrate', 'resize'],
    exampleConfig: {
      outputFormat: 'webp',
      quality: 85,
      resize: { width: 800, height: 600, fit: 'contain' },
    },
    acceptsInputTypes: ['file', 'image', 'audio', 'video', 'binary'],
    producesOutputType: 'file',
  },
]
