import React from 'react';
import {View,Text} from 'react-native';
import PropTypes from 'prop-types';
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 FontAwesome5 from 'react-native-vector-icons/FontAwesome5'
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'


const _IconClass = {
    AntDesign: 'AntDesign',
    Entypo: 'Entypo',
    EvilIcons: 'EvilIcons',
    Feather: 'Feather',
    FontAwesome: 'FontAwesome',
    FontAwesome5: 'FontAwesome5',
    Foundation: 'Foundation',
    Ionicons: 'Ionicons',
    MaterialIcons: 'MaterialIcons',
    MaterialCommunityIcons: 'MaterialCommunityIcons',
    Octicons: 'Octicons',
    Zocial: 'Zocial',
    SimpleLineIcons: 'SimpleLineIcons'
};

function getIconFromClass(props){
    if(props.class === undefined) return <MaterialIcons {...props}/>;
    switch (props.class) {
        case _IconClass.AntDesign:
            return <AntDesign {...props}/>;
        case _IconClass.Entypo:
            return <Entypo {...props}/>;
        case _IconClass.EvilIcons:
            return <EvilIcons {...props}/>;
        case _IconClass.Feather:
            return <Feather {...props}/>;
        case _IconClass.FontAwesome:
            return <FontAwesome {...props}/>;
        case _IconClass.FontAwesome5:
            return <FontAwesome5 {...props}/>;
        case _IconClass.Foundation:
            return <Foundation {...props}/>;
        case _IconClass.Ionicons:
            return <Ionicons {...props}/>;
        case _IconClass.MaterialCommunityIcons:
            return <MaterialCommunityIcons {...props}/>;
        case _IconClass.MaterialIcons:
            return <MaterialIcons {...props}/>;
        case _IconClass.Octicons:
            return <Octicons {...props}/>;
        case _IconClass.SimpleLineIcons:
            return <SimpleLineIcons {...props}/>;
        case _IconClass.Zocial:
            return <Zocial {...props}/>;
        default:
            return <MaterialIcons {...props}/>;
    }
}

export default class Icon extends React.Component {

    static get ClassName() {return _IconClass}

    render() {
        return (
            getIconFromClass(this.props)
        )
    }
}



Icon.propTypes = {
    class: PropTypes.string,
    size: PropTypes.number,
    name: PropTypes.string,
    color: PropTypes.string,
};

