import Styles from "@/constants/Styles";
import { useTheme } from "@/providers/ThemeProvider";
import { Pressable, View } from "react-native";
import Text from "../Text";

type Props = {
   text: string;
   isSelected: boolean;
   isSign?: boolean;
   isSignCalendar?: boolean;
   isSignTask?: boolean;
   onPress?: () => void;
}

export default function ItemDateCalendar({ text, isSelected, isSign, isSignCalendar, isSignTask, onPress }: Props) {
   const { colors } = useTheme()

   const showMulti = isSignCalendar !== undefined || isSignTask !== undefined;

   return (
      <Pressable style={Styles.contentItemCenter} onPress={onPress}>
         <Text style={[isSelected ? Styles.cWhite : { color: colors.text }]}>{text}</Text>
         {showMulti ? (
            <View style={Styles.calendarDotRow}>
               <View style={[Styles.calendarDot, { backgroundColor: isSignCalendar ? (isSelected ? 'white' : '#7886C7') : 'transparent' }]} />
               <View style={[Styles.calendarDot, { backgroundColor: isSignTask ? (isSelected ? 'white' : '#94B4C1') : 'transparent' }]} />
            </View>
         ) : (
            <View style={[Styles.signDate, { backgroundColor: isSign ? 'red' : 'transparent' }]} />
         )}
      </Pressable>
   )
}