import React from 'react';
import AntDesign from 'react-native-vector-icons/AntDesign';
import Entypo from 'react-native-vector-icons/Entypo';
import EvilIcons from 'react-native-vector-icons/EvilIcons';
import Feather from 'react-native-vector-icons/Feather';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
import Fontisto from 'react-native-vector-icons/Fontisto';
import Foundation from 'react-native-vector-icons/Foundation';
import Ionicons from 'react-native-vector-icons/Ionicons';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import Octicons from 'react-native-vector-icons/Octicons';
import Zocial from 'react-native-vector-icons/Zocial';
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons';
import { GlobalTheme } from '../theme';


function CustomIcon({
  iconLibrary,
  icon,
  size = 22,
  color = GlobalTheme.colors.primary,
  style = {},
  ...rest
}) {
  let Icon = AntDesign;

  switch (iconLibrary) {
    case 'AntDesign':
      Icon = AntDesign;
      break;
    case 'Entypo':
      Icon = Entypo;
      break;
    case 'EvilIcons':
      Icon = EvilIcons;
      break;
    case 'Feather':
      Icon = Feather;
      break;
    case 'FontAwesome':
      Icon = FontAwesome;
      break;
    case 'Fontisto':
      Icon = Fontisto;
      break;
    case 'Foundation':
      Icon = Foundation;
      break;
    case 'Ionicons':
      Icon = Ionicons;
      break;
    case 'MaterialIcons':
      Icon = MaterialIcons;
      break;
    case 'MaterialCommunityIcons':
      Icon = MaterialCommunityIcons;
      break;
    case 'Octicons':
      Icon = Octicons;
      break;
    case 'Zocial':
      Icon = Zocial;
      break;
    case 'SimpleLineIcons':
      Icon = SimpleLineIcons;
      break;
    default:
      Icon = AntDesign;
  }

  return <Icon name={icon} size={size} style={style} color={color} {...rest} />;
}

export default CustomIcon;
