import { Intent } from './cardNumber';
import { CSSProperties } from './element';

/**
 * All payment method options for qrcode element, those payment method type integration will render qrcode from your checkout site to specific provider’s authentication page.
 */
export type PaymentMethodWithQrcode =
  | 'alipaycn'
  | 'alipayhk'
  | 'kakaopay'
  | 'gcash'
  | 'tng'
  | 'truemoney'
  | 'wechatpay'
  | 'fps'
  | 'cash_app_pay'
  | 'rabbit_line_pay'
  | 'pix'
  | 'payme'
  | 'pay_now';

/**
 * Apply to qrcode element type integration, interface used when call createElement with type `qrcode`
 */
export interface QrcodeElementPaymentOptions {
  /**
   * The payment intent you would like to checkout
   * Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/)
   *
   */
  /**
   * @deprecated Please use {@link intent_id} and {@link client_secret} instead.
   */
  intent?: Intent;
  qrcodeMethod?: PaymentMethodWithQrcode;
  intent_id: string;
  client_secret: string;
  mode: 'payment';
  /**
   * Box style for the QRcode element.
   */
  style?: CSSProperties;
}

export interface QrcodeElementRecurringOptions {
  mode: 'recurring';
  client_secret: string;
  currency: string;
  customer_id: string;
  qrcodeMethod: 'wechatpay';
  merchant_trigger_reason?: 'scheduled' | 'unscheduled';
  /**
   * Box style for the QRcode element.
   */
  style?: CSSProperties;
}

export type QrcodeElementOptions = QrcodeElementPaymentOptions | QrcodeElementRecurringOptions;
