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

import {
  array,
  boolean,
  lazy,
  nullable,
  number,
  object,
  optional,
  Schema,
  string,
} from '../schema';
import { SearchCard, searchCardSchema } from './searchCard';

/**
 * Encapsulates the details of a Summary Request.
 * Summary Request fields are same as the Search Request base class and no new fields are required.
 */
export interface SummaryRequest {
  /** Account ID of the customer.<br/> Optional.<br/> This input is a search criterion, if given. */
  accountId?: number | null;
  /** Account Number of the customer.<br/> Optional.<br/> This input is a search criterion, if given. */
  accountNumber?: string | null;
  /**
   * Collecting Company Code (Shell Code) of the selected payer. <br />
   * Optional If ColCo Id or ColCoCountryCode is passed else Mandatory.<br />
   */
  colCoCode?: number | null;
  /**
   * The 2 character ISO Code for the customer and card owning country.<br />
   * Optional If ColCoId or ColCoCode is passed else Mandatory.<br />
   */
  colCoCountryCode?: string | null;
  /**
   * Collecting Company Id (in ) of the selected payer.<br />
   * Optional If ColCo Codeor ColCoCountryCode is passed else Mandatory <br />
   */
  colCoId?: number | null;
  /**
   * Payer Id (i.e. Customer Id of the Payment Customer ) of the selected payer.<br />
   * Optional if PayerNumber is passed else Mandatory
   */
  payerId?: number | null;
  /**
   * Payer Number of the selected payer.<br />
   * Optional if PayerId is passed else Mandatory
   */
  payerNumber?: string | null;
  /**
   * Card group id.<br />
   * Optional. <br />
   * This input is a search criterion, if given.<br />
   * When -1 is passed, those cards that does not belong to any card group will be returned.
   */
  cardGroupId?: number | null;
  /**
   * Card group name.<br />
   * Optional.<br />
   * This input is a search criterion, if given.<br />
   * If CardGroupId is provided then this search criterion will be ignored, else, those cards that have the card group name completely matching with the entered value will be returned
   */
  cardGroupName?: string | null;
  /**
   * Status of the card.<br />
   * Mandatory.<br />
   * Multiple statuses are allowed to be included in the search criteria.<br />
   * CardStatus filter accepts either of the two values for each status as described below. However, the output field “StatusDescription” is aligned with second value highlighted in italics.<br />
   * Below are the possible allowed statuses: <br />
   * • ACTIVE or Active – Cards at status Active (The result will include all the cards having the following intermediate statuses as defined s, if the IncludeIntermediateStatus flag is true: Active (Block in progress), Active (Cancel in progress), Active (Marked as damaged)), New (Cancel in progress).<br />
   * • ON_ORDER or New – Cards at status New <br />
   * • EXPIRED or Expired – Cards at status Expired<br />
   * • BLOCKED or Blocked Card – Cards at status Block (The result will include all cards having the following intermediate status as defined, if the IncludeIntermediateStatus flag is true: Blocked card (Unblock in progress))<br />
   * • TEMP_BLOCKED_CUSTOMER or Temporary Block(Customer) – Cards at status Temporary Blocked By Customer<br />
   * • TEMP_BLOCKED_SHELL or Temporary Block (Shell) – Cards at Status Temporary Blocked by Shell<br />
   * • CANCELLED or Cancelled – Cards at status Cancelled<br />
   * • PENDING_RENEWAL or Pending Renewal - Cards that are in renewal process<br />
   * • REPLACED or Replaced – Cards at Status Replaced<br />
   * • FRAUD or Fraud – Cards at Status FRAUD<br />
   * • ALL
   */
  cardStatus: string[] | null;
  /**
   * Cards active and expiring in given number of days.<br />
   * Optional<br />
   * Note: When a value is passed in this parameter, only active cards will be considered while searching.
   */
  expiringInDays?: number | null;
  /**
   * If provided, only list cards issued after the given date<br />
   * Optional<br />
   * Format: yyyyMMdd<br />
   * Note: Clients to convert this to appropriate DateTime type.
   */
  issuedAfter?: string | null;
  /**
   * Last digits of the PAN number<br />
   * Minimum 4 last digits of the card should be sent for this field to be considered as part of the search criteria.<br />
   * Optional<br />
   * Max Length: 50
   */
  pANEndsWith?: string | null;
  /**
   * Driver Name embossed on the card<br />
   * Optional<br />
   * Up to 10 driver names could be passed in the parameter.<br />
   * Minimum of 4 characters should be provided for each driver name else not considered.<br />
   * Those cards will be returned when part of the driver name matches with any of the string passed in the list.<br />
   * Max Length for each Driver name: 50
   */
  driverName?: string[];
  /**
   * Vehicle Registration embossed on the card<br />
   * Optional<br />
   * Up to 10 vehicle registration numbers could be passed in the parameter.<br />
   * Minimum of 4 characters should be provided for each VRN else not considered<br />
   * Those cards will be returned when part of the VRN matches with any of the string passed in the list.<br />
   * Max Length for each VRN: 50
   */
  vehicleRegistrationNumber?: string[];
  /**
   * List of SearchCard entity i.e., Card Id or PAN, which needs to be included in the response.<br />
   * Details of the SerachCard entity are given below.
   */
  includeCards?: SearchCard[];
  /**
   * List of SearchCard entity i.e., Card Id or PAN, which needs to be excluded in the response. <br />
   * Details of the SerachCard entity are given below.
   */
  excludeCards?: SearchCard[];
  /**
   * Bundle Id for the Card, which needs to be excluded in the response.<br />
   * Optional
   */
  excludeBundleId?: string | null;
  /**
   * Market segment to which card belongs to.<br />
   * Optional.<br />
   * Allowed values<br />
   * • CRT<br />
   * • Fleet
   */
  cardSegment?: string | null;
  /**
   * Purchase category code of the card.<br />
   * Optional.
   */
  purchaseCategoryCode?: string | null;
  /**
   * ISO code of the card i.e. first 7 digits of the PAN<br />
   * Optional.
   */
  cardTypeCode?: string | null;
  /**
   * Default value is True.<br />
   * When true, the API will not return cards that are at Pending Renewal Status in Cards Platform
   */
  excludePendingRenewalCards?: boolean;
  /**
   * Default value is True.<br />
   * When true, the API will not return cards that are at Cancelled Status in Cards Platform
   */
  excludeCancelledCards?: boolean;
  /**
   * Default value is False.<br />
   * When true, the API will not return cards that are at Replaced Status in Cards Platform
   */
  excludeReplacedCards?: boolean;
  /**
   * Default value is False.<br />
   * When true, the API will not return cards that are at Fraud Status in Cards Platform
   */
  excludeFraudCards?: boolean;
  /**
   * Optional<br />
   * When passed, the API will not return cards that are currently in the Card Group specified
   */
  excludeCardGroupId?: number | null;
  /**
   * Optional<br />
   * When passed, the API will not return cards that are currently in the Card Group specified
   */
  excludeCardGroupName?: string | null;
  /**
   * Card Creation Date<br />
   * Optional<br />
   * Format: yyyyMMdd
   */
  creationDate?: string | null;
  /**
   * Effective date for the Card<br />
   * Optional<br />
   * Format: yyyyMMdd
   */
  effectiveDate?: string | null;
  /**
   * Cards allowed to be used in site.<br />
   * Optional.<br />
   * Allowed values<br />
   * • ShellSitesOnly<br />
   * • PartnersSitesIncluded<br />
   */
  network?: string | null;
  /**
   * Cards allowed to used nationally/internationally.<br />
   * Optional.<br />
   * Allowed values<br />
   *  -National<br />
   *  -International
   */
  coverage?: string | null;
  /**
   * Month in which the card is expiring.<br />
   * Optional.<br />
   * Format: MMYYYY
   */
  expiryMonth?: string | null;
  /**
   * Default Value: False<br />
   * When this field is set to True, cards with below status 2 years (configurable) ago and earlier are excluded from the result<br />
   *  -Blocked Card<br />
   *  -Expired<br />
   *  -Cancelled<br />
   *  -Suspended<br />
   *  -Blocked<br />
   *  -Expired and Cancelled<br />
   *  -Replaced<br />
   *  -Replaced By<br />
   *  -Closed<br />
   *  -Fraud<br />
   */
  excludeOldCards?: boolean;
  /**
   * Default Value: All<br />
   * Optional<br />
   * This option is used to filter the list of cards with ‘ReissueSetting’.<br />
   * If ‘True’, the API will return cards with ReIssueSetting value is true.<br />
   * If ‘False’, the API will return cards with ReIsssueSetting value is false.<br />
   * If ‘ALL’, API will return cards with ReIssueSetting value True &amp; False both.<br />
   * Allowed Values:<br />
   * 1.    All<br />
   * 2.    True<br />
   * 3.    False
   */
  reissueSetting?: string | null;
  requestId: string | null;
}

export const summaryRequestSchema: Schema<SummaryRequest> = object({
  accountId: ['AccountId', optional(nullable(number()))],
  accountNumber: ['AccountNumber', optional(nullable(string()))],
  colCoCode: ['ColCoCode', optional(nullable(number()))],
  colCoCountryCode: ['ColCoCountryCode', optional(nullable(string()))],
  colCoId: ['ColCoId', optional(nullable(number()))],
  payerId: ['PayerId', optional(nullable(number()))],
  payerNumber: ['PayerNumber', optional(nullable(string()))],
  cardGroupId: ['CardGroupId', optional(nullable(number()))],
  cardGroupName: ['CardGroupName', optional(nullable(string()))],
  cardStatus: ['CardStatus', nullable(array(string()))],
  expiringInDays: ['ExpiringInDays', optional(nullable(number()))],
  issuedAfter: ['IssuedAfter', optional(nullable(string()))],
  pANEndsWith: ['PANEndsWith', optional(nullable(string()))],
  driverName: ['DriverName', optional(array(string()))],
  vehicleRegistrationNumber: [
    'VehicleRegistrationNumber',
    optional(array(string())),
  ],
  includeCards: ['IncludeCards', optional(array(lazy(() => searchCardSchema)))],
  excludeCards: ['ExcludeCards', optional(array(lazy(() => searchCardSchema)))],
  excludeBundleId: ['ExcludeBundleId', optional(nullable(string()))],
  cardSegment: ['CardSegment', optional(nullable(string()))],
  purchaseCategoryCode: ['PurchaseCategoryCode', optional(nullable(string()))],
  cardTypeCode: ['CardTypeCode', optional(nullable(string()))],
  excludePendingRenewalCards: [
    'ExcludePendingRenewalCards',
    optional(boolean()),
  ],
  excludeCancelledCards: ['ExcludeCancelledCards', optional(boolean())],
  excludeReplacedCards: ['ExcludeReplacedCards', optional(boolean())],
  excludeFraudCards: ['ExcludeFraudCards', optional(boolean())],
  excludeCardGroupId: ['ExcludeCardGroupId', optional(nullable(number()))],
  excludeCardGroupName: ['ExcludeCardGroupName', optional(nullable(string()))],
  creationDate: ['CreationDate', optional(nullable(string()))],
  effectiveDate: ['EffectiveDate', optional(nullable(string()))],
  network: ['Network', optional(nullable(string()))],
  coverage: ['Coverage', optional(nullable(string()))],
  expiryMonth: ['ExpiryMonth', optional(nullable(string()))],
  excludeOldCards: ['ExcludeOldCards', optional(boolean())],
  reissueSetting: ['ReissueSetting', optional(nullable(string()))],
  requestId: ['RequestId', nullable(string())],
});
