// tools-registry.jsx — single source of truth for all AI tools.
//
// To add a new tool: append a config object below. The tools market page,
// the landing page, and the dashboard all read from this registry.
//
// For NEW tool TYPES that need a custom UI (e.g. Video editor with timeline),
// build a screen component (screens/<name>-tool.jsx) and reference it via
// `screen: '<ComponentName>'`. For simple prompt→output tools, leave `screen`
// off and the generic GenericToolScreen template will render based on `inputs`.

const TOOLS_REGISTRY = [
  // ── Image ──────────────────────────────────────────────
  {
    id: 'image-gen',
    name: 'Image Generator',
    desc: 'Photorealistic & artistic text-to-image with style controls.',
    category: 'Image · Create', cat: 'image',
    icon: 'image', color: '#22d3ee',
    rating: '4.9', runs: '2.4M', credits: 1, tag: 'POPULAR',
    screen: 'ImageToolScreen',
  },
  {
    id: 'bg-remover',
    name: 'Background Remover',
    desc: 'Single-click cutout for products, portraits, transparent PNGs.',
    category: 'Image · Edit', cat: 'image',
    icon: 'eraser', color: '#4ade80',
    rating: '4.9', runs: '3.1M', credits: 1,
    inputs: [
      { type: 'upload', label: 'Source image', accept: 'image/*' },
      { type: 'select', label: 'Edge mode', options: ['Auto', 'Hair-aware', 'Hard'] },
    ],
    output: 'image',
  },
  {
    id: 'upscaler',
    name: 'Image Upscaler',
    desc: '4× and 8× upscale with detail recovery and face restore.',
    category: 'Image · Edit', cat: 'image',
    icon: 'upscale', color: '#60a5fa',
    rating: '4.8', runs: '1.2M', credits: 2,
    inputs: [
      { type: 'upload', label: 'Source image', accept: 'image/*' },
      { type: 'segmented', label: 'Scale', options: ['2×', '4×', '8×'] },
      { type: 'toggle', label: 'Face restore' },
    ],
    output: 'image',
  },
  {
    id: 'sketch-to-image',
    name: 'Sketch to Image',
    desc: 'Turn rough sketches into rendered concepts you can iterate on.',
    category: 'Image · Create', cat: 'image',
    icon: 'sparkle', color: '#22d3ee',
    rating: '4.7', runs: '510k', credits: 1,
  },

  // ── Writing ────────────────────────────────────────────
  {
    id: 'writer',
    name: 'AI Writer',
    desc: 'Articles, ads, scripts. Saves brand voice across drafts.',
    category: 'Writing · Long-form', cat: 'writing',
    icon: 'pen', color: '#a78bfa',
    rating: '4.8', runs: '1.8M', credits: 2,
    screen: 'WriterToolScreen',
  },
  {
    id: 'translator',
    name: 'Translator Pro',
    desc: 'Context-aware translation across 100+ languages.',
    category: 'Writing · Translate', cat: 'writing',
    icon: 'translate', color: '#a78bfa',
    rating: '4.9', runs: '2.0M', credits: 1,
    inputs: [
      { type: 'textarea', label: 'Source text', placeholder: 'Paste text to translate…' },
      { type: 'select', label: 'From', options: ['Auto-detect', 'English', 'Chinese', 'Japanese', 'French'] },
      { type: 'select', label: 'To', options: ['English', 'Chinese', 'Japanese', 'Spanish', 'French', 'German'] },
      { type: 'segmented', label: 'Tone', options: ['Neutral', 'Formal', 'Casual'] },
    ],
    output: 'text',
  },
  {
    id: 'code',
    name: 'Code Assistant',
    desc: 'Refactor, explain, translate. 30+ languages, 200k tokens.',
    category: 'Writing · Code', cat: 'writing',
    icon: 'code', color: '#22d3ee',
    rating: '4.7', runs: '680k', credits: 1,
  },
  {
    id: 'summarizer',
    name: 'Doc Summarizer',
    desc: 'Drop a 100-page PDF, get a structured 1-page brief.',
    category: 'Utility · Read', cat: 'utility',
    icon: 'layers', color: '#4ade80',
    rating: '4.8', runs: '780k', credits: 1,
    inputs: [
      { type: 'upload', label: 'PDF or text file', accept: '.pdf,.txt,.docx' },
      { type: 'segmented', label: 'Length', options: ['Short', 'Medium', 'Long'] },
      { type: 'segmented', label: 'Style', options: ['Bullets', 'Outline', 'Prose'] },
    ],
    output: 'text',
  },

  // ── Video ──────────────────────────────────────────────
  {
    id: 'video',
    name: 'Video Studio',
    desc: 'Prompt-to-clip up to 8s. Animate stills with camera moves.',
    category: 'Video · Generate', cat: 'video',
    icon: 'video', color: '#a78bfa',
    rating: '4.7', runs: '420k', credits: 12, tag: 'NEW',
    screen: 'VideoToolScreen',
  },
  {
    id: 'avatar',
    name: 'Talking Avatar',
    desc: 'Bring a portrait to life with synced lip motion and voice.',
    category: 'Video · Avatar', cat: 'video',
    icon: 'bot', color: '#a78bfa',
    rating: '4.6', runs: '230k', credits: 8, tag: 'BETA',
  },

  // ── Audio ──────────────────────────────────────────────
  {
    id: 'voice',
    name: 'Voice Synth',
    desc: '40+ natural voices. Clone your own from a 30s sample.',
    category: 'Audio · Speech', cat: 'audio',
    icon: 'voice', color: '#fbbf24',
    rating: '4.8', runs: '910k', credits: 3,
    inputs: [
      { type: 'textarea', label: 'Script', placeholder: 'Type what the voice should say…' },
      { type: 'select', label: 'Voice', options: ['Aria · warm female', 'Knox · deep male', 'Sage · neutral', 'Custom clone (Maya)'] },
      { type: 'slider', label: 'Speed', min: 0.5, max: 1.5, step: 0.05, default: 1 },
      { type: 'slider', label: 'Pitch', min: -6, max: 6, step: 1, default: 0 },
    ],
    output: 'audio',
  },
  {
    id: 'audio-clean',
    name: 'Audio Cleaner',
    desc: 'Remove room noise, hum, and clicks. Studio-grade in seconds.',
    category: 'Audio · Restore', cat: 'audio',
    icon: 'flash', color: '#fbbf24',
    rating: '4.8', runs: '340k', credits: 2,
    inputs: [
      { type: 'upload', label: 'Audio file', accept: 'audio/*' },
      { type: 'slider', label: 'Noise reduction', min: 0, max: 100, step: 5, default: 70 },
      { type: 'toggle', label: 'De-hum' },
      { type: 'toggle', label: 'De-click' },
    ],
    output: 'audio',
  },
];

const CATEGORIES = [
  { id: 'all', label: 'All tools' },
  { id: 'image', label: 'Image' },
  { id: 'writing', label: 'Writing' },
  { id: 'video', label: 'Video' },
  { id: 'audio', label: 'Audio' },
  { id: 'utility', label: 'Utility' },
].map(c => ({ ...c, count: c.id === 'all' ? TOOLS_REGISTRY.length : TOOLS_REGISTRY.filter(t => t.cat === c.id).length }));

Object.assign(window, { TOOLS_REGISTRY, CATEGORIES });
