import { useState } from "react"
import ButtonMenuHeader from "../buttonMenuHeader"
import DrawerBottom from "../drawerBottom"
import { View } from "react-native"
import Styles from "@/constants/Styles"
import MenuItemRow from "../menuItemRow"
import { MaterialCommunityIcons } from "@expo/vector-icons"
import AlertKonfirmasi from "../alertKonfirmasi"
import { router } from "expo-router"

type Props = {
   id: string | string[]
}

export default function HeaderRightDivisionInfo({ id }: Props) {
   const [isVisible, setVisible] = useState(false)
   return (
      <>
         <ButtonMenuHeader onPress={() => { setVisible(true) }} />
         <DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu">
            <View style={Styles.rowItemsCenter}>
               <MenuItemRow
                  icon={<MaterialCommunityIcons name="pencil-outline" color="black" size={25} />}
                  title="Edit Divisi"
                  onPress={() => {
                     setVisible(false)
                     router.push(`/division/${id}/edit`)
                  }}
               />
               <MenuItemRow
                  icon={<MaterialCommunityIcons name="toggle-switch-off-outline" color="black" size={25} />}
                  title="Non Aktifkan"
                  onPress={() => {
                     AlertKonfirmasi({
                        title: 'Konfirmasi',
                        desc: 'Apakah anda yakin ingin menonaktifkan divisi?',
                        onPress: () => {
                           setVisible(false)
                           router.push('/division')
                        }
                     })
                  }}
               />
            </View>
         </DrawerBottom>
      </>
   )
}