/**
 * 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 { Name, nameSchema } from './name';
import { PhoneWithType, phoneWithTypeSchema } from './phoneWithType';

/** The details about a customer in PayPal's system of record. */
export interface PaypalWalletCustomer {
  /** The unique ID for a customer generated by PayPal. */
  id?: string;
  /** The internationalized email address. Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists. */
  emailAddress?: string;
  /** The phone information. */
  phone?: PhoneWithType;
  /** The name of the party. */
  name?: Name;
  /** Merchants and partners may already have a data-store where their customer information is persisted. Use merchant_customer_id to associate the PayPal-generated customer.id to your representation of a customer. */
  merchantCustomerId?: string;
}

export const paypalWalletCustomerSchema: Schema<PaypalWalletCustomer> = object({
  id: ['id', optional(string())],
  emailAddress: ['email_address', optional(string())],
  phone: ['phone', optional(lazy(() => phoneWithTypeSchema))],
  name: ['name', optional(lazy(() => nameSchema))],
  merchantCustomerId: ['merchant_customer_id', optional(string())],
});
