import Button from "@components/Button";
import Box from "@components/bases/Box";
import InformationIcon from "@components/icons/InformationIcon";
import { create } from "react-modal-promise";
import { Text } from "react-native";

interface Props {
	isOpen: boolean;
	onResolve: () => void;
	// biome-ignore lint/suspicious/noExplicitAny: <explanation>
	onReject: any;
}

const MyModal = ({ isOpen, onResolve, onReject }: Props) => {
	return (
		<Box
			width={300}
			// height={200}
			backgroundColor={"white"}
			alignItems={"center"}
			justifyContent={"center"}
			alignSelf={"center"}
			marginTop={"x240"}
			position={"absolute"}
			zIndex={10}
			borderRadius={20}
			gap={"m"}
			shadowColor={"black"}
			shadowOffset={{ width: 0, height: 0 }}
			shadowOpacity={0.5}
			p={"m"}
			visible={isOpen}
		>
			<InformationIcon />
			<Text>Modal</Text>
			<Box style={{ width: "80%" }}>
				<Button
					variant={"fullInformation"}
					textVariants={"white"}
					label={"Ok"}
					onPress={onResolve}
				/>

				<Button
					variant={"noMargin"}
					textVariants={"error"}
					label="Fermer"
					onPress={() => onReject("Fermer")}
				/>
			</Box>
		</Box>
	);
};

const myPromiseModal = create(MyModal);

export { myPromiseModal };

export default MyModal;
