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

import {
  boolean,
  lazy,
  nullable,
  number,
  object,
  optional,
  Schema,
  string,
} from '../schema';
import { Accounts, accountsSchema } from './accounts';
import {
  SearchCardRestriction,
  searchCardRestrictionSchema,
} from './searchCardRestriction';

export interface SearchCardRestrictionReq {
  /**
   * Collecting Company Id of the selected payer.
   * Optional if ColCoCode is passed else Mandatory.
   * Example:
   * 1 for Philippines
   * 5 for UK
   */
  colCoId?: number | null;
  /**
   * Collecting Company Code (Shell Code) of the selected payer.
   * Mandatory for serviced OUs such as Romania, Latvia, Lithuania, Estonia, Ukraine etc. It is optional for other countries if ColCoID is provided.
   * Example:
   * 86 for Philippines
   * 5 for UK
   */
  colCoCode?: number | null;
  /**
   * Payer Id (i.e. Customer Id of the Payment Customer) of the selected payer.
   * Optional if PayerNumber is passed else Mandatory
   * Example: 123456
   */
  payerId?: number | null;
  /**
   * Payer Number of the selected payer.
   * Optional if PayerId is passed else Mandatory
   * Example: GB000000123
   */
  payerNumber?: string;
  accounts?: Accounts;
  /**
   * Identifier of the Card bundle
   * Optional if cards list is given, else mandatory.
   * This input is a search criterion, if given.
   */
  bundleId?: string | null;
  cards?: SearchCardRestriction;
  /**
   * True/False
   * Whether to include location restriction of the cards in the response.
   * Optional
   * Default ‘false’
   */
  includeLocationRestrictions?: boolean | null;
  /**
   * Default value is False,
   * When the value is True, API will return bundle Id associated with cards in the response, if available.
   * Note: Use ‘Null’ or ‘False’ for optimum performance. A delay in response is expected when set to ‘True’.
   */
  includeBundleDetails?: boolean | null;
  /**
   * Default value is True,
   * When True: service will return the inherited values for the usage limits (from card-program or account as available) when it is not overridden on the card.
   */
  includeInheritedLimits?: boolean | null;
}

export const searchCardRestrictionReqSchema: Schema<SearchCardRestrictionReq> = object(
  {
    colCoId: ['ColCoId', optional(nullable(number()))],
    colCoCode: ['ColCoCode', optional(nullable(number()))],
    payerId: ['PayerId', optional(nullable(number()))],
    payerNumber: ['PayerNumber', optional(string())],
    accounts: ['Accounts', optional(lazy(() => accountsSchema))],
    bundleId: ['BundleId', optional(nullable(string()))],
    cards: ['Cards', optional(lazy(() => searchCardRestrictionSchema))],
    includeLocationRestrictions: [
      'IncludeLocationRestrictions',
      optional(nullable(boolean())),
    ],
    includeBundleDetails: [
      'IncludeBundleDetails',
      optional(nullable(boolean())),
    ],
    includeInheritedLimits: [
      'IncludeInheritedLimits',
      optional(nullable(boolean())),
    ],
  }
);
