/**
 * Shell Card Management APIsLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { nullable, number, object, optional, Schema, string } from '../schema';

/** Response entity object for SubmittedCard list <br/>Note: This list will be empty for status 9006 and 9012 i.e., request for all the cards failed. */
export interface SubmittedCard {
  /**
   * Reference number for tracking of replacement card order request of the specific card,<br />
   * This is applicable for requests with target status as Block and OrderReplacement passed as True.
   */
  replacementCardReference?: number | null;
  /** Reference number for tracking of update status request of the specific card, */
  updateCardReference?: number | null;
  /**
   * Account Id of the customer.<br />
   * Optional if AccountNumber is passed, else Mandatory.
   */
  accountId?: number | null;
  /**
   * Account Number of the customer.<br />
   * Optional if AccountId is passed, else Mandatory.
   */
  accountNumber?: string | null;
  /**
   * Expiry date of the card.<br />
   * Mandatory if PAN is passed, else optional.<br />
   * Format: yyyyMMdd
   */
  cardExpiryDate?: string | null;
  /**
   * Card Id of the card.<br />
   * Optional if PAN is passed, else Mandatory.
   */
  cardId?: number | null;
  /**
   * Collecting company code of the customer. <br />
   * Optional if ColCoId is passed, else Mandatory.<br />
   */
  colCoCode?: number | null;
  /**
   * Collecting company id of the customer. <br />
   * Optional if ColCoCode is passed, else Mandatory.<br />
   */
  colCoId?: number | null;
  /**
   * PAN of the card.<br />
   * Optional if CardId is passed, else Mandatory.<br />
   */
  pAN?: string | null;
  /** PANID of the card */
  pANID?: number | null;
  /** Card PAN */
  maskedPAN?: string | null;
  /**
   * Payer id of the customer.<br />
   * Optional if PayerNumber is passed, else Mandatory.
   */
  payerId?: number | null;
  /**
   * PayerNumber of the customer.<br />
   * Optional if PayerId is passed, else Mandatory.
   */
  payerNumber?: string | null;
}

export const submittedCardSchema: Schema<SubmittedCard> = object({
  replacementCardReference: [
    'ReplacementCardReference',
    optional(nullable(number())),
  ],
  updateCardReference: ['UpdateCardReference', optional(nullable(number()))],
  accountId: ['AccountId', optional(nullable(number()))],
  accountNumber: ['AccountNumber', optional(nullable(string()))],
  cardExpiryDate: ['CardExpiryDate', optional(nullable(string()))],
  cardId: ['CardId', optional(nullable(number()))],
  colCoCode: ['ColCoCode', optional(nullable(number()))],
  colCoId: ['ColCoId', optional(nullable(number()))],
  pAN: ['PAN', optional(nullable(string()))],
  pANID: ['PANID', optional(nullable(number()))],
  maskedPAN: ['MaskedPAN', optional(nullable(string()))],
  payerId: ['PayerId', optional(nullable(number()))],
  payerNumber: ['PayerNumber', optional(nullable(string()))],
});
