import React from 'react';
import {Platform,ToastAndroid,Alert,View,TouchableOpacity,Text} from 'react-native';
import CustomModal from './CustomModal';
import { useRoute } from '@react-navigation/native';
import { customStyles, GetPageTheme } from '../styles/Global';

export const CustomAlert = (title='',msg='',onCancel=function (){},onDone=function (){}) => {
    Alert.alert(
        title,
        msg,
        [
          {
            text: "Cancel",
            onPress: () => console.log('tw'),
            style: "cancel"
          },
          { text: "OK", onPress: () => console.log('jhdh') }
        ]
    );
}

export function ConfirmSaveAlert(props,showAlert=false,onCancelCallBack=()=>{},onYesCallBack=()=>{},msg='Do you really want to save data?'){
  const route = useRoute();
  const PageTheme=GetPageTheme(props.DarkMode,route.name);
  const customStyle=customStyles(props.DarkMode,route.name);
  const ST= props.StaticText || {};

  return (
    <CustomModal 
      style={customStyle.storelVisitM_Style}
      titleStyle={customStyle.storelVisitM_titleStyle}
      title={msg}
      showModal={showAlert}
    >
      <View style={customStyle.storelVisitM_options}>
       <TouchableOpacity style={customStyle.storelVisitM_op_btn} onPress={()=>{onCancelCallBack()}}>
          <Text style={customStyle.storelVisitM_op_btnText}>{ST.Cancel}</Text>
        </TouchableOpacity>
        <TouchableOpacity style={customStyle.storelVisitM_op_btn} onPress={()=>{onYesCallBack()}}>
          <Text style={customStyle.storelVisitM_op_btnText}>{ST.Yes}</Text>
        </TouchableOpacity>
      </View>
    </CustomModal>
  )
}



export function ExitScreenAlert(props,callback){
  Alert.alert(
      "",
      "Do you really want to exit the screen?",
      [
        {
          text: "Cancel",
          onPress: () => {},
          style: "cancel"
        },
        { text: "OK", onPress: () => {props.navigation.goBack();} }
      ]
    );
}

