import React from 'react';
import {
  View,
  Image,
  StyleSheet,
  TouchableOpacity,
  TouchableOpacityProps,
} from 'react-native';

interface NavigationIconProps extends TouchableOpacityProps {
  tab: 'Home' | 'Search' | 'Upload' | 'Notifications' | 'Profile';
  disabled?: boolean;
}

const NavigationIcon = (props: NavigationIconProps) => {
  let imgSrc;
  switch (props.tab) {
    case 'Home':
      imgSrc = props.disabled
        ? require('../../assets/navigationIcons/home-new.png')
        : require('../../assets/navigationIcons/home-new-clicked.png');
      break;
    case 'Search':
      imgSrc = props.disabled
        ? require('../../assets/navigationIcons/search.png')
        : require('../../assets/navigationIcons/search-clicked.png');
      break;
    case 'Upload':
      imgSrc = props.disabled
        ? require('../../assets/navigationIcons/upload.png')
        : require('../../assets/navigationIcons/upload-clicked.png');
      break;
    case 'Notifications':
      imgSrc = props.disabled
        ? require('../../assets/navigationIcons/notifications.png')
        : require('../../assets/navigationIcons/notifications-clicked.png');
      break;
    case 'Profile':
      imgSrc = props.disabled
        ? require('../../assets/navigationIcons/profile.png')
        : require('../../assets/navigationIcons/profile-clicked.png');
      break;
    default:
      imgSrc = null;
  }
  return (
    <View style={styles.icon}>
      <TouchableOpacity {...props}>
        <Image source={imgSrc} />
      </TouchableOpacity>
    </View>
  );
};

const styles = StyleSheet.create({
  icon: {
    flex: 1,
    justifyContent: 'center',
    shadowColor: '#000000',
    shadowOffset: {
      width: 0,
      height: 2,
    },
    shadowRadius: 2,
    shadowOpacity: 0.4,
  },
});

export default NavigationIcon;
