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

import { object, optional, Schema, string } from '../schema';
import { CardBrand, cardBrandSchema } from './cardBrand';

/** Previous network transaction reference including id and network. */
export interface NetworkTransactionReferenceEntity {
  /** Transaction reference id returned by the scheme. For Visa and Amex, this is the "Tran id" field in response. For MasterCard, this is the "BankNet reference id" field in response. For Discover, this is the "NRID" field in response. The pattern we expect for this field from Visa/Amex/CB/Discover is numeric, Mastercard/BNPP is alphanumeric and Paysecure is alphanumeric with special character -. */
  id: string;
  /** The date that the transaction was authorized by the scheme. This field may not be returned for all networks. MasterCard refers to this field as "BankNet reference date. */
  date?: string;
  /** The card network or brand. Applies to credit, debit, gift, and payment cards. */
  network?: CardBrand;
  /** The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates. */
  time?: string;
}

export const networkTransactionReferenceEntitySchema: Schema<NetworkTransactionReferenceEntity> = object(
  {
    id: ['id', string()],
    date: ['date', optional(string())],
    network: ['network', optional(cardBrandSchema)],
    time: ['time', optional(string())],
  }
);
