import { Feather } from "@expo/vector-icons"
import { ButtonHeader } from "./buttonHeader"
import AlertKonfirmasi from "./alertKonfirmasi"

type Props = {
   category: 'create' | 'update' | 'cancel'
   onPress?: () => void
   disable?: boolean
}

export default function ButtonSaveHeader({ category, onPress, disable }: Props) {
   return (
      <>
         <ButtonHeader
            item={<Feather name="check" size={20} color={disable == false ? "grey" : "white"} />}
            onPress={() => {
               AlertKonfirmasi({
                  title: 'Konfirmasi',
                  desc: category == 'create'
                     ? 'Apakah anda yakin ingin menambahkan data?'
                     : category == 'cancel'
                        ? 'Apakah anda yakin ingin membatalkan kegiatan? Pembatalan bersifat permanen'
                        : 'Apakah anda yakin mengubah data?',
                  onPress: () => {
                     onPress && onPress()
                  }
               })
            }

            }
         />
      </>
   )
}