/**
 * Paypal Server SDKLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { lazy, object, optional, Schema } from '../schema';
import { CustomerRequest, customerRequestSchema } from './customerRequest';
import {
  PaymentTokenRequestPaymentSource,
  paymentTokenRequestPaymentSourceSchema,
} from './paymentTokenRequestPaymentSource';

/** Payment Token Request where the `source` defines the type of instrument to be stored. */
export interface PaymentTokenRequest {
  /** Customer in merchant's or partner's system of records. */
  customer?: CustomerRequest;
  /** The payment method to vault with the instrument details. */
  paymentSource: PaymentTokenRequestPaymentSource;
}

export const paymentTokenRequestSchema: Schema<PaymentTokenRequest> = object({
  customer: ['customer', optional(lazy(() => customerRequestSchema))],
  paymentSource: [
    'payment_source',
    lazy(() => paymentTokenRequestPaymentSourceSchema),
  ],
});
