import { PaymentIntent, PaymentMethod } from "@stripe/stripe-react-native";
import { ReactElement } from "react";

export type PaymentProviderProps = {
  children: ReactElement | ReactElement[];
  stripePublishableKey: string;
};

export type PaymentProps = {
  stripePublishableKey: string;
  createPaymentIntent({
    card,
    paymentMethod,
  }: {
    card: TCard;
    paymentMethod: PaymentMethod.Result;
  }): Promise<{ clientSecret: string; intentId: string }>;
  onPaymentSuccess?: (paymentIntent: PaymentIntent.Result) => void;
  onBack?: () => void;
};

export type TCard = {
  name: string;
  email: string;
  country: string;
  postalCode: number;
  city: string;
  state: string;
  line1: string;
  line2: string;
  complete: boolean;
};
