/**
 * 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 {
  SetupTokenRequestPaymentSource,
  setupTokenRequestPaymentSourceSchema,
} from './setupTokenRequestPaymentSource';

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

export const setupTokenRequestSchema: Schema<SetupTokenRequest> = object({
  customer: ['customer', optional(lazy(() => customerRequestSchema))],
  paymentSource: [
    'payment_source',
    lazy(() => setupTokenRequestPaymentSourceSchema),
  ],
});
