import * as LucideIcons from 'lucide-react';
import { FIELD_TYPES } from './FormTypes';

// Associer les icônes à chaque type de champ
export const FIELD_TYPES_WITH_ICONS = FIELD_TYPES.map((fieldType) => {
  let icon = null;

  switch (fieldType.value) {
    case 'text':
      icon = LucideIcons.TextCursorInput;
      break;
    case 'email':
      icon = LucideIcons.AtSign;
      break;
    case 'phone':
      icon = LucideIcons.Phone;
      break;
    case 'date':
      icon = LucideIcons.Calendar;
      break;
    case 'select':
      icon = LucideIcons.ChevronDown;
      break;
    case 'radio':
      icon = LucideIcons.Radio;
      break;
    case 'checkbox':
      icon = LucideIcons.CheckSquare;
      break;
    case 'toggle':
      icon = LucideIcons.ToggleLeft;
      break;
    case 'file':
      icon = LucideIcons.FileUp;
      break;
    case 'signature':
      icon = LucideIcons.PenTool;
      break;
    case 'textarea':
      icon = LucideIcons.Type;
      break;
    case 'paragraph':
      icon = LucideIcons.AlignLeft;
      break;
    case 'heading1':
      icon = LucideIcons.Heading1;
      break;
    case 'heading2':
      icon = LucideIcons.Heading2;
      break;
    case 'heading3':
      icon = LucideIcons.Heading3;
      break;
    case 'heading4':
      icon = LucideIcons.Heading4;
      break;
    case 'heading5':
      icon = LucideIcons.Heading5;
      break;
    case 'heading6':
      icon = LucideIcons.Heading6;
      break;
    default:
      break;
  }

  return {
    ...fieldType,
    icon,
  };
});

export default FIELD_TYPES_WITH_ICONS;
