import React from 'react';
import { Text, View, FlatList } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import { getStyles } from './estimates.styles';
import { MOCK_ESTIMATES } from '../../mock-data/estimates';
import { useTheme } from '../../theme';

export const EstimatesScreen = () => {
  const { theme: colors } = useTheme();
  const styles = getStyles(colors);

  return (
    <View style={styles.container}>
      <FlatList
        data={MOCK_ESTIMATES}
        keyExtractor={item => item.id}
        contentContainerStyle={styles.listContent}
        renderItem={({ item }) => (
          <View style={styles.card}>
            <View style={styles.header}>
              <View style={styles.titleWrapper}>
                <Icon
                  name="calculator-outline"
                  size={20}
                  color={item.color}
                  style={styles.icon}
                />
                <Text style={styles.title}>{item.number}</Text>
              </View>
              <Text style={styles.value}>{item.value}</Text>
            </View>
            <View style={styles.body}>
              <Text style={styles.client}>Client: {item.client}</Text>
              <Text style={styles.date}>Date: {item.date}</Text>
            </View>
            <View style={styles.footer}>
              <View
                style={[styles.badge, { backgroundColor: `${item.color}15` }]}
              >
                <Text style={[styles.badgeText, { color: item.color }]}>
                  {item.status}
                </Text>
              </View>
            </View>
          </View>
        )}
      />
    </View>
  );
};
