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

import { lazy, object, optional, Schema, string } from '../schema';
import {
  GooglePayCardResponse,
  googlePayCardResponseSchema,
} from './googlePayCardResponse';
import {
  PhoneNumberWithCountryCode,
  phoneNumberWithCountryCodeSchema,
} from './phoneNumberWithCountryCode';

/** Google Pay Wallet payment data. */
export interface GooglePayWalletResponse {
  /** The full name representation like Mr J Smith. */
  name?: string;
  /** The internationalized email address.<blockquote><strong>Note:</strong> Up to 64 characters are allowed before and 255 characters are allowed after the <code>@</code> sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted <code>@</code> sign exists.</blockquote> */
  emailAddress?: string;
  /** The phone number in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). */
  phoneNumber?: PhoneNumberWithCountryCode;
  /** The payment card to use to fund a Google Pay payment response. Can be a credit or debit card. */
  card?: GooglePayCardResponse;
}

export const googlePayWalletResponseSchema: Schema<GooglePayWalletResponse> = object(
  {
    name: ['name', optional(string())],
    emailAddress: ['email_address', optional(string())],
    phoneNumber: [
      'phone_number',
      optional(lazy(() => phoneNumberWithCountryCodeSchema)),
    ],
    card: ['card', optional(lazy(() => googlePayCardResponseSchema))],
  }
);
