import React, { FC } from 'react';
import { View, Text } from 'react-native';

import Button from '../Button/Button';
import Modal from './Modal';

type props = {
  isVisible: boolean;
  setIsVisible: (value: boolean) => void;
  title: string;
  text: string;
  onConfirm: () => void;
};

const ConfirmationModal: FC<props> = ({ isVisible, setIsVisible, title, text, onConfirm }) => (
  <Modal
    title={title}
    isVisible={isVisible}
    setIsVisible={setIsVisible}
    buttons={
      <View className="flex-row">
        <Button classNames="px-4" variant="text" onPress={() => setIsVisible(false)}>
          Ne
        </Button>
        <Button
          classNames="pl-4"
          variant="text"
          onPress={() => {
            setIsVisible(false);
            onConfirm();
          }}
        >
          Ano
        </Button>
      </View>
    }
  >
    <View>
      <Text className="mb-2">{text}</Text>
    </View>
  </Modal>
);

export default ConfirmationModal;
