/*
 * File: CaseCard.tsx
 * Description: Component to display a single case card
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */

import React from 'react';
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
import { Card } from 'shared/src/components/Card';
import { CustomIcon } from 'shared/src/components/Icons';
import { Colors, Spacing, Typography } from 'shared/src/theme';
import { Case } from '../redux/dashboardSlice';

interface CaseCardProps {
  item: Case;
  onPress: (item: Case) => void;
}

/**
 * CaseCard - displays a single case card
 */
const CaseCard: React.FC<CaseCardProps> = ({ item, onPress }) => (
  <TouchableOpacity onPress={() => onPress(item)}>
    <Card style={styles.card}>
      <View style={styles.row}>
        <CustomIcon
          name={item.status === 'critical' ? 'alert' : item.status === 'urgent' ? 'alert-outline' : 'check-circle'}
          color={item.status === 'critical' ? Colors.error : item.status === 'urgent' ? Colors.warning : Colors.success}
          size={24}
        />
        <View style={styles.info}>
          <Text style={styles.patient}>{item.patientName}</Text>
          <Text style={styles.desc}>{item.description}</Text>
        </View>
        <Text style={styles.confidence}>{item.aiConfidence}%</Text>
      </View>
    </Card>
  </TouchableOpacity>
);

const styles = StyleSheet.create({
  card: {
    marginBottom: Spacing.sm,
  },
  row: {
    flexDirection: 'row',
    alignItems: 'center',
  },
  info: {
    flex: 1,
    marginLeft: Spacing.sm,
  },
  patient: {
    fontFamily: Typography.fontFamily.bold,
    fontSize: Typography.fontSize.md,
    color: Colors.textPrimary,
  },
  desc: {
    fontFamily: Typography.fontFamily.regular,
    fontSize: Typography.fontSize.sm,
    color: Colors.textSecondary,
  },
  confidence: {
    fontFamily: Typography.fontFamily.bold,
    fontSize: Typography.fontSize.md,
    color: Colors.info,
    marginLeft: Spacing.sm,
  },
});

export default CaseCard;

/*
 * End of File: CaseCard.tsx
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */ 