import AlertKonfirmasi from "@/components/alertKonfirmasi";
import ButtonBackHeader from "@/components/buttonBackHeader";
import { ButtonHeader } from "@/components/buttonHeader";
import ItemDetailMember from "@/components/itemDetailMember";
import Styles from "@/constants/Styles";
import { useAuthSession } from "@/providers/AuthProvider";
import { Octicons } from "@expo/vector-icons";
import { router, Stack } from "expo-router";
import { Image, SafeAreaView, ScrollView, Text, View } from "react-native";

export default function Profile() {
   const {signOut, token} = useAuthSession()

   return (
      <SafeAreaView>
         <Stack.Screen
            options={{
               headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
               headerTitle: 'Profile',
               headerTitleAlign: 'center',
               headerShadowVisible: false,
               headerRight: () => <ButtonHeader
                  item={<Octicons name="sign-out" size={20} color="white" />}
                  onPress={() => {
                     AlertKonfirmasi({
                        title: 'Keluar',
                        desc: 'Apakah anda yakin ingin keluar?',
                        // onPress: () => { router.push('/') }
                        onPress: () => { signOut()}
                     })
                  }}
               />
            }}
         />
         <ScrollView>
            <View style={{ flexDirection: 'column' }}>
               <View style={[Styles.wrapHeadViewMember]}>
                  <Image
                     source={require("../../assets/images/user.jpeg")}
                     style={[Styles.userProfileBig]}
                  />
                  <Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10]}>Putri Ayu Dewi</Text>
                  <Text style={[Styles.textMediumNormal, Styles.cWhite]}>Super Admin</Text>
               </View>
               <View style={[Styles.p15]}>
                  <View style={[Styles.rowSpaceBetween]}>
                     <Text style={[Styles.textDefaultSemiBold]}>Informasi</Text>
                     <Text style={[Styles.textLink]}>Edit</Text>
                  </View>
                  <ItemDetailMember category="nik" value="123456789" />
                  <ItemDetailMember category="group" value="Dinas" />
                  <ItemDetailMember category="position" value="Sekretaris" />
                  <ItemDetailMember category="phone" value="08980873782" />
                  <ItemDetailMember category="email" value="putri@gmail.com" />
                  <ItemDetailMember category="gender" value="Perempuan" />
               </View>
            </View>
         </ScrollView>
      </SafeAreaView>
   )
}