import React from 'react';
import { CloseIcon } from './closeIcon';
import { MenuIcon } from './menuIcon';
import { SettingIcon } from './settingIcon';
import { AchievementIcon } from './achievementIcon';
import { PhoneIcon } from './phoneIcon';
import { InstagramIcon } from './instagramIcon';
import ShowMoreIcon from './showMoreIcon';
import CategoryGhazaghiIcon from './categoryGhazaghiIcon';
import CategoryGhermezIcon from './categoryGhermezIcon';
import categorySemiromIcon from './categorySemiromIcon';
import CategoryZardIcon from './categoryZardIcon';
import AchievementIconWhite from './achievementIconWhite';
import { LocationIcon } from './locationIcon';
import { EmailIcon } from './emailIcon';

export const icons = {
  close: CloseIcon,
  menu: MenuIcon,
  setting: SettingIcon,
  achievement: AchievementIcon,
  achievementWhite: AchievementIconWhite,
  phone: PhoneIcon,
  instagram: InstagramIcon,
  showMore: ShowMoreIcon,
  location: LocationIcon,
  email: EmailIcon,
  categoryGhazaghi: CategoryGhazaghiIcon,
  categoryGhermez: CategoryGhermezIcon,
  categorySemirom: categorySemiromIcon,
  categoryZard: CategoryZardIcon,
};

export type IconName = keyof typeof icons;

interface IconProps extends React.SVGProps<SVGSVGElement> {
  name: IconName;
}

export const Icon = ({ name, ...props }: IconProps) => {
  const Component = icons[name];
  if (!Component) return null;
  return <Component {...props} />;
};
