import type { PaymentCode } from "@/utils/requests/types";
import { images } from "@styles/Commons";
import { Image, TouchableOpacity } from "react-native";
import Box from "./bases/Box";

type PaymentOptions = "OM" | "MTN" | "FLOOZ" | "WAVE" | "CB";

type Props = {
	onPress: () => void;
	paymentMethod: PaymentCode;
};

const PaymentOptionContainer = ({ children }: { children: React.ReactNode }) => {
	return (
		<Box
			height={50}
			// p={"s"}
			style={{ width: "100%", height: "100%" }}
			overflow={"hidden"}
			backgroundColor={"yellow"}
			borderRadius={30}
		>
			{children}
		</Box>
	);
};

const Orange = () => {
	return (
		<Image source={require("../../assets/operators/orange_money.png")} style={images.cover} />
	);
};

const Mtn = () => {
	return <Image source={require("../../assets/operators/mtn_money.png")} style={images.cover} />;
};

const Flooz = () => {
	return <Image source={require("../../assets/operators/moov_money.png")} style={images.cover} />;
};

const Wave = () => {
	return <Image source={require("../../assets/operators/wave_money.png")} style={images.cover} />;
};

const Cb = () => {
	return <Image source={require("../../assets/operators/visa_card.png")} style={images.cover} />;
};

const PaymentOption = ({ onPress, paymentMethod }: Props) => {
	return (
		<TouchableOpacity style={{ width: "100%", height: "100%" }} onPress={onPress}>
			{paymentMethod === "OM" && <Orange />}
			{paymentMethod === "MTN" && <Mtn />}
			{paymentMethod === "FLOOZ" && <Flooz />}
			{paymentMethod === "WAVE" && <Wave />}
			{paymentMethod === "CB" && <Cb />}
		</TouchableOpacity>
	);
};

export default PaymentOption;
