/**
 * 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';
import {
  OrderCardEnquiryReqReferenceTypeEnum,
  orderCardEnquiryReqReferenceTypeEnumSchema,
} from './orderCardEnquiryReqReferenceTypeEnum';

/** This class holds Order Card Enquiry list based on which the Order Card Enquiry need to be filtered. */
export interface OrderCardEnquiryReq {
  /** Account ID of the customer.<br/> Optional if AccountNumber is passed, else mandatory. <br/> This input is a search criterion, if given. */
  accountId?: number | null;
  /** Account Number of the customer.<br/> Optional if AccountId is passed, else mandatory.<br/> This input is a search criterion, if given. */
  accountNumber?: string | null;
  /**
   * Collecting Company Code (Shell Code) of the selected payer. <br />
   * Optional – when ‘ReferenceNumber’ is provided.<br />
   */
  colCoCode?: number | null;
  /**
   * Collecting Company Id (in ) of the selected payer. <br />
   * Optional – when ‘ReferenceNumber’ is provided. Else, either ‘ColCoId’ or ‘ColCoCode’ is mandatory.<br />
   */
  colCoId?: number | null;
  /** ISO 3166 Alpha-2 Country Code for the customer and card owning country. */
  colCoCountryCode?: string | null;
  /**
   * Payer Id (i.e. Customer Id of the Payment Customer) of the selected payer.<br />
   * Optional – when ‘ReferenceNumber’ is provided. Else, either ‘PayerId’ or ‘PayerNumber’ is mandatory.
   */
  payerId?: number | null;
  /**
   * Payer Number of the selected payer.<br />
   * Optional – when ‘ReferenceNumber’ is provided. Else, either ‘PayerId’ or ‘PayerNumber’ is mandatory.
   */
  payerNumber?: string | null;
  /**
   * Reference number of the Card Order/ Bulk Card Order/ Order Card Request.<br />
   * Mandatory when ColCo and Payer fields are not provided. Else, optional.
   */
  referenceNumber?: number;
  /**
   * Type of the reference number provided.<br />
   * Mandatory if ReferenceNumber is provided. Else optional.<br />
   * Allowed Values:<br />
   * 1=Main Reference(Main Order Reference Number returned in the output of Card/OrderCard service. <br />
   * 2=Order Card Reference (Reference number for each individual card in the order submitted via Card/OrderCard service. <br />
   * 3=Bulk Order Card Reference (Reference number returned in the response of bulkcardinterface /UploadOrderCardTemplate. )
   */
  referenceType?: OrderCardEnquiryReqReferenceTypeEnum;
  /**
   * Card Orders from Date/Time.<br />
   * Optional.<br />
   * Value should be with in last 7 days<br />
   * This field is ignored if ReferenceNumber is provided <br />
   * This field is optional when not provided and ReferenceNumber is null or empty then the value should be set to D-7(Where D is current date)<br />
   * Format: yyyyMMdd
   */
  fromDate?: string | null;
  /**
   * Card Order to Date/Time<br />
   * Optional<br />
   * Value should be with in last 7 days<br />
   * This field is ignored if ReferenceNumber is provided <br />
   * This field is optional when not provided and ReferenceNumber is null or empty then the value should be set to current date<br />
   * Format: yyyyMMdd
   */
  toDate?: string | null;
  /** Client provided Unique Id of the original Order Card request, the status of which is enquired by this API */
  orderRequestId?: string | null;
}

export const orderCardEnquiryReqSchema: Schema<OrderCardEnquiryReq> = object({
  accountId: ['AccountId', optional(nullable(number()))],
  accountNumber: ['AccountNumber', optional(nullable(string()))],
  colCoCode: ['ColCoCode', optional(nullable(number()))],
  colCoId: ['ColCoId', optional(nullable(number()))],
  colCoCountryCode: ['ColCoCountryCode', optional(nullable(string()))],
  payerId: ['PayerId', optional(nullable(number()))],
  payerNumber: ['PayerNumber', optional(nullable(string()))],
  referenceNumber: ['ReferenceNumber', optional(number())],
  referenceType: [
    'ReferenceType',
    optional(orderCardEnquiryReqReferenceTypeEnumSchema),
  ],
  fromDate: ['FromDate', optional(nullable(string()))],
  toDate: ['ToDate', optional(nullable(string()))],
  orderRequestId: ['OrderRequestId', optional(nullable(string()))],
});
