import Styles from "@/constants/Styles";
import React from "react";
import { Pressable, Text, View } from "react-native";
import LabelStatus from "./labelStatus";
import { Feather } from "@expo/vector-icons";

type Props = {
   title: string
   subtitle?: string | React.ReactNode
   icon: React.ReactNode
   desc?: string
   rightTopInfo?: string
   onPress?: () => void
   borderType: 'all' | 'bottom' | 'none'
   leftBottomInfo?: React.ReactNode | string
   rightBottomInfo?: React.ReactNode | string
   titleWeight?: 'normal' | 'bold'
}

export default function BorderBottomItem({ title, subtitle, icon, desc, onPress, rightTopInfo, borderType, leftBottomInfo, rightBottomInfo, titleWeight }: Props) {
   return (
      <Pressable style={[borderType == 'bottom' ? Styles.wrapItemBorderBottom : borderType == 'all' ? Styles.wrapItemBorderAll : Styles.wrapItemBorderNone]} onPressOut={onPress}>
         <View style={[Styles.rowItemsCenter]}>
            {icon}
            <View style={[Styles.rowSpaceBetween, { width: '85%' }]}>
               <View style={[Styles.ml10]}>
                  <Text style={[titleWeight == 'normal' ? Styles.textDefault : Styles.textDefaultSemiBold]}>{title}</Text>
                  {
                     subtitle &&
                        typeof subtitle == "string"
                        ? <Text style={[Styles.textMediumNormal, { lineHeight: 15 }]}>{subtitle}</Text>
                        : <View style={{ alignItems: 'flex-start' }}>
                           {subtitle}
                        </View>
                  }
               </View>
               {
                  rightTopInfo && <Text style={[Styles.textInformation]}>{rightTopInfo}</Text>
               }
            </View>

         </View>
         {desc && <Text style={[Styles.textDefault, Styles.mt05, { textAlign: 'justify' }]}>{desc}</Text>}
         {
            (leftBottomInfo || rightBottomInfo) &&
            (
               <View style={[Styles.rowSpaceBetween, Styles.mt10]}>
                  {
                     typeof leftBottomInfo == 'string' ?
                        <Text style={[Styles.textInformation, Styles.cGray, { textAlign: 'left' }]}>{leftBottomInfo}</Text>
                        :
                        leftBottomInfo
                  }
                  {
                     typeof rightBottomInfo == 'string' ?
                        <Text style={[Styles.textInformation, Styles.cGray, { textAlign: 'right' }]}>{rightBottomInfo}</Text>
                        :
                        rightBottomInfo
                  }
               </View>
            )
         }
      </Pressable>
   )
}