/**
 * 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.js';
import { Address, addressSchema } from './address.js';
import { BankAccount, bankAccountSchema } from './bankAccount.js';
import {
  CustomerContract,
  customerContractSchema,
} from './customerContract.js';
import {
  FinanceCurrency2,
  financeCurrency2Schema,
} from './financeCurrency2.js';
import {
  InvoiceDistributionMethod,
  invoiceDistributionMethodSchema,
} from './invoiceDistributionMethod.js';

export interface PayerDetails {
  /** Collecting company id of the customer. */
  colCoId?: number | null;
  /** Collecting company code of the customer. */
  colCoCode?: number | null;
  /** ISO code of the customer country. */
  countryCode?: string | null;
  /** Country of the customer */
  country?: string | null;
  /** Payer id of the customer */
  payerId?: number | null;
  /** Payer Number of the customer */
  payerNumber?: string | null;
  /** Full Name of the Payer */
  payerFullName?: string | null;
  /** Short name of the payer */
  payerShortName?: string | null;
  /** Payer Group Id */
  payerGroupId?: number | null;
  /** Invoiced amount and due for payment from the last SOA. */
  amountDue?: number | null;
  /** Invoiced amount and overdue for payment from the last SOA. */
  amountOverdue?: number | null;
  /** Invoiced amount and not overdue for payment from the last SOA. */
  amountNotOverdue?: number | null;
  /** Current outstanding balance amount from the last SOA. */
  outstandingBalance?: number | null;
  /**
   * Unallocated payment.
   * When negative, indicates overdue amount from the last SOA.
   */
  unallocatedPayment?: number | null;
  /** Currency ISO code */
  sOACurrencyCode?: string | null;
  /** Currency symbol */
  sOACurrencySymbol?: string | null;
  /** Currency ISO code */
  sOACreditLimitCurrencyCode?: string | null;
  /** Currency symbol */
  sOACreditLimitCurrencySymbol?: string | null;
  /** Currency ISO code */
  lastPaymentCurrencyCode?: string | null;
  /** currency symbol */
  lastPaymentCurrencySymbol?: string | null;
  /** Latest payment amount for the requested payer. */
  lastPaymentAmount?: number | null;
  /** Latest payment date for the requested payer. */
  lastPaymentDate?: string | null;
  /** Last payment amount in statement of account for the requested payer. */
  sOALastPaymentAmount?: number | null;
  /** Last payment date in statement of account for the requested payer. */
  sOALastPaymentDate?: string | null;
  /** Currency ISO code */
  currencyCode?: string | null;
  /** Currency Symbol */
  currencySymbol?: string | null;
  /** The 2-character ISO Code for the customer and card owning country. */
  colCoCountryCode?: string | null;
  /** Currency ISO code of the local country. */
  localCurrencyCode?: string | null;
  /** Currency Symbol of the local country */
  localCurrencySymbol?: string | null;
  /** Exchange rate from OU base currency to local currency. */
  localCurrencyExchangeRate?: number | null;
  /** Exchange rate from SoA credit limit currency to local currency */
  localCurrencyExchangeRateSoA?: number | null;
  /**
   * Billing/Invoice frequency Identifier. Indicates the frequency in which the transactions will be considered for invoicing in a bulling run
   * E.g.: 1, 2, 3, etc.
   */
  billingFrequencyTypeId?: number | null;
  /**
   * Billing/Invoice frequency. The frequency in which the transactions will be considered for invoicing in a bulling run
   * E.g.:
   * 1    Daily (all days)
   * 2    Daily (only working days)
   * 3    Weekly - Monday
   * 4    Weekly – Tuesday
   * Etc.
   */
  billingFrequencyType?: string | null;
  /**
   * Frequency at which the billing process is triggered.
   * E.g.: 1, 2, 3, etc.
   */
  billingRunFrequencyTypeId?: number | null;
  /**
   * Frequency at which the billing process is triggered.E.g.:
   * 1    Daily (all days)
   * 2    Daily (only working days)
   * 3    Weekly - Monday
   * 4    Weekly – Tuesday
   * Etc.
   */
  billingRunFrequnecy?: string | null;
  /** The first day in a month when the billing should run in case of multiple billing runs configured with in a single month. */
  day1Run?: number | null;
  /** The second day in a month when the billing should run in case of multiple billing runs configured with in a single month. */
  day2Run?: number | null;
  /** The third day in a month when the billing should run in case of multiple billing runs configured with in a single month. */
  day3Run?: number | null;
  /** The fourth day in a month when the billing should run in case of multiple billing runs configured with in a single month. */
  day4Run?: number | null;
  invoiceDistributionMethods?: InvoiceDistributionMethod[];
  /**
   * Invoice output type (Id-Description)
   * E.g.:
   * 1-PDF
   * 6-Print
   */
  outputType?: string | null;
  /** The Account ID of the account on which the invoice is generated. */
  invoiceAccountID?: number | null;
  /** The Account Number of the account on which the invoice is generated. */
  invoiceAccountNumber?: string | null;
  /** The Account Short Name of the account on which the invoice is generated. */
  invoiceAccountShortName?: string | null;
  /** Best of Indicator of the Pricing customer/account configured. */
  bestOfIndicator?: boolean;
  /** Whether the account is international. */
  isInternational?: boolean;
  /** Total number of accounts under the payer. */
  totalAccounts?: number | null;
  /** Total number of active accounts under the payer. */
  totalActiveAccounts?: number | null;
  /** Total number of cards under the payer. */
  totalCards?: number | null;
  /** Total number of active cards under the payer. */
  totalActiveCards?: number | null;
  /** Total number of cards under the payer that are permanently blocked */
  totalBlockedCards?: number | null;
  /** Total number of cards under the payer that are cancelled */
  totalCancelledCards?: number | null;
  /** Total number of expired cards under the payer. */
  totalExpiredCards?: number | null;
  /** Total number of Renewal Pending cards under the payer. */
  totalRenewalPendingCards?: number | null;
  /** Total number of cards under the payer with status as “Replaced */
  totalReplacedCards?: number | null;
  /** Total number of cards under the payer that are temporarily blocked by customer. */
  totalTemporaryBlockCardsByCustomer?: number | null;
  /** Total number of cards under the payer that are temporarily blocked by Shell. */
  totalTemporaryBlockCardsByShell?: number | null;
  /** Total number of cards in “New” status */
  totalNewCards?: number | null;
  /** Total number of cards in Fraud status */
  totalFraudCards?: number | null;
  /** Total number of accounts in Blocked status */
  totalBlockedAccounts?: number | null;
  /** Total number of accounts in Cancel status */
  totalCancelledAccounts?: number | null;
  /** Trading name for the Payer */
  payerTradingName?: string | null;
  /**
   * Payer current status id and description
   * e.g. (Id – Description):
   * 1-Active
   * 2-Requested from UTA
   * 3-Awaiting embossing
   * 4-Manufactured
   * 5-Awaiting despatch
   */
  status?: string;
  /** Payer Billing Language id and description */
  billingLanguage?: string | null;
  /** Legal entity id and description of the Payer */
  legalEntity?: string | null;
  /** Payer/Company Established Date. */
  dateEstablished?: string | null;
  /** Payer/Company Classification id and description */
  customerClassification?: string | null;
  /** Payer/Company Industry class id and description */
  industryClass?: string | null;
  /** Marketing Segmentation id and description */
  marketingSegmentation?: string | null;
  /** Payer/Company Line of Business Id and Description */
  lineOfBusiness?: string | null;
  /**
   * Is Credit Limit printed on the statement of account: True/False
   * If True Credit Limit is printed on invoice/SOA
   */
  printCreditLimit?: boolean;
  /**
   * Card Group Type configured for Payer
   * e.g. (Id – Description):
   * 1-Horizontal only
   * 2-Vertical only
   * 3-Both
   */
  cardGroupType?: string | null;
  /** If set to True cards will be automatically renewed on expiry */
  renewCards?: boolean;
  /** If set to True then Self Select PIN is allowed for Payer */
  allowSelectPIN?: boolean;
  /** If set to True then Fleet PIN is applied for the cards directly under payer */
  useFleetPIN?: boolean;
  /** Payer/Company VAT registration number. */
  vATRegNumber?: string | null;
  /** Payer/Company VAT registration number 2. */
  vATRegNumber2?: string;
  /** Payer/Company Registration number */
  registrationNumber?: string | null;
  /** Payer/Company Registration number2 */
  registrationNumber2?: string | null;
  /** Sales Ledger Balance (Billed) */
  salesLedgerBalance?: number | null;
  /** Exposure after guarantee */
  exposure?: number | null;
  /** Total outstanding debt (including billed and unbilled sales and fee items) */
  outstandingDebt?: number | null;
  /**
   * The available credit for the payer.
   * This is the credit limit minus the outstanding debt.
   */
  availableCredit?: number | null;
  /**
   * Band Id and Description of the Payer in Card Platform.
   * e.g. (Id – Description):
   * 1-Platinum
   * 2-Gold
   * 3-Silver
   * 4-Bronze
   */
  band?: string | null;
  /** Global Customer reference id configured in card platform for Payer (Same as Payer Group) */
  globalCustomerReferenceId?: string | null;
  /** Payment Credit limit of Payer. */
  creditLimit?: number | null;
  /**
   * Credit limit in Customer currency.
   * Note: For currency details refer the parameters CurrencyCode & CurrencySymbol in the PayerDetail response.
   */
  creditLimitInCustomerCurrency?: number | null;
  /** Customer Billing currency ISO code. */
  billingCurrencyCode?: string | null;
  /** Customer Billing currency Symbol. */
  billingCurrencySymbol?: string | null;
  /** Payment method Id and Description as configured for Payer in Card Platform */
  paymentMethod?: string | null;
  /** Payment terms Id and Description as configured for Payer in Card Platform */
  paymentTerms?: string | null;
  /** Temporary Credit limit increase value */
  temporaryCreditLimitIncrease?: number | null;
  /** Temporary Credit limit increase value */
  temporaryCreditLimitIncreaseInCustomerCurrency?: number | null;
  /** Temporary Credit limit expiry date */
  temporaryCreditLimitExpiryDate?: string | null;
  payerBankAccount?: BankAccount[];
  cardDeliveryAddress?: Address;
  correspondanceAddress?: Address;
  billingAddress?: Address;
  /**
   * True, if the payer is setup for volume-based pricing and is active on the current date, else false.
   * This field is returned only when IncludeBonusParameters is set to True in the request. Else set to null.
   */
  hasActiveVolBasedPricing?: boolean;
  /**
   * True, if the payer is setup for volume-based bonus and is active on the current date, else false.
   * This field is returned only when IncludeBonusParameters is set to True in the request. Else set to null.
   */
  hasActiveVolBasedBonus?: boolean;
  /**
   * True, if the payer is setup for volume-based association bonus and is active on the current date, else false.
   * This field is returned only when IncludeBonusParameters is set to True in the request. Else set to null.
   */
  hasActiveVolBasedAssociationBonus?: boolean;
  financeCurrency?: FinanceCurrency2;
  /**
   * Customer id in e-TM system
   * This field will have value only when ReturnTollsCustomerId is set to true in the request else set to null or empty.
   */
  tollsCustomerId?: string | null;
  /**
   * String    Colco country type id in e-TM system
   * This field will have value only when ReturnTollsCustomerId is set to true in the request else set to null or empty.
   */
  tollsColcoCountryTypeId?: string | null;
  contracts?: CustomerContract[];
}

export const payerDetailsSchema: Schema<PayerDetails> = lazy(() =>
  object({
    colCoId: ['ColCoId', optional(nullable(number()))],
    colCoCode: ['ColCoCode', optional(nullable(number()))],
    countryCode: ['CountryCode', optional(nullable(string()))],
    country: ['Country', optional(nullable(string()))],
    payerId: ['PayerId', optional(nullable(number()))],
    payerNumber: ['PayerNumber', optional(nullable(string()))],
    payerFullName: ['PayerFullName', optional(nullable(string()))],
    payerShortName: ['PayerShortName', optional(nullable(string()))],
    payerGroupId: ['PayerGroupId', optional(nullable(number()))],
    amountDue: ['AmountDue', optional(nullable(number()))],
    amountOverdue: ['AmountOverdue', optional(nullable(number()))],
    amountNotOverdue: ['AmountNotOverdue', optional(nullable(number()))],
    outstandingBalance: ['OutstandingBalance', optional(nullable(number()))],
    unallocatedPayment: ['UnallocatedPayment', optional(nullable(number()))],
    sOACurrencyCode: ['SOACurrencyCode', optional(nullable(string()))],
    sOACurrencySymbol: ['SOACurrencySymbol', optional(nullable(string()))],
    sOACreditLimitCurrencyCode: [
      'SOACreditLimitCurrencyCode',
      optional(nullable(string())),
    ],
    sOACreditLimitCurrencySymbol: [
      'SOACreditLimitCurrencySymbol',
      optional(nullable(string())),
    ],
    lastPaymentCurrencyCode: [
      'LastPaymentCurrencyCode',
      optional(nullable(string())),
    ],
    lastPaymentCurrencySymbol: [
      'LastPaymentCurrencySymbol',
      optional(nullable(string())),
    ],
    lastPaymentAmount: ['LastPaymentAmount', optional(nullable(number()))],
    lastPaymentDate: ['LastPaymentDate', optional(nullable(string()))],
    sOALastPaymentAmount: [
      'SOALastPaymentAmount',
      optional(nullable(number())),
    ],
    sOALastPaymentDate: ['SOALastPaymentDate', optional(nullable(string()))],
    currencyCode: ['CurrencyCode', optional(nullable(string()))],
    currencySymbol: ['CurrencySymbol', optional(nullable(string()))],
    colCoCountryCode: ['ColCoCountryCode', optional(nullable(string()))],
    localCurrencyCode: ['LocalCurrencyCode', optional(nullable(string()))],
    localCurrencySymbol: ['LocalCurrencySymbol', optional(nullable(string()))],
    localCurrencyExchangeRate: [
      'LocalCurrencyExchangeRate',
      optional(nullable(number())),
    ],
    localCurrencyExchangeRateSoA: [
      'LocalCurrencyExchangeRate_SoA',
      optional(nullable(number())),
    ],
    billingFrequencyTypeId: [
      'BillingFrequencyTypeId',
      optional(nullable(number())),
    ],
    billingFrequencyType: [
      'BillingFrequencyType',
      optional(nullable(string())),
    ],
    billingRunFrequencyTypeId: [
      'BillingRunFrequencyTypeId',
      optional(nullable(number())),
    ],
    billingRunFrequnecy: ['BillingRunFrequnecy', optional(nullable(string()))],
    day1Run: ['Day1Run', optional(nullable(number()))],
    day2Run: ['Day2Run', optional(nullable(number()))],
    day3Run: ['Day3Run', optional(nullable(number()))],
    day4Run: ['Day4Run', optional(nullable(number()))],
    invoiceDistributionMethods: [
      'InvoiceDistributionMethods',
      optional(array(invoiceDistributionMethodSchema)),
    ],
    outputType: ['OutputType', optional(nullable(string()))],
    invoiceAccountID: ['InvoiceAccountID', optional(nullable(number()))],
    invoiceAccountNumber: [
      'InvoiceAccountNumber',
      optional(nullable(string())),
    ],
    invoiceAccountShortName: [
      'InvoiceAccountShortName',
      optional(nullable(string())),
    ],
    bestOfIndicator: ['BestOfIndicator', optional(boolean())],
    isInternational: ['IsInternational', optional(boolean())],
    totalAccounts: ['TotalAccounts', optional(nullable(number()))],
    totalActiveAccounts: ['TotalActiveAccounts', optional(nullable(number()))],
    totalCards: ['TotalCards', optional(nullable(number()))],
    totalActiveCards: ['TotalActiveCards', optional(nullable(number()))],
    totalBlockedCards: ['TotalBlockedCards', optional(nullable(number()))],
    totalCancelledCards: ['TotalCancelledCards', optional(nullable(number()))],
    totalExpiredCards: ['TotalExpiredCards', optional(nullable(number()))],
    totalRenewalPendingCards: [
      'TotalRenewalPendingCards',
      optional(nullable(number())),
    ],
    totalReplacedCards: ['TotalReplacedCards', optional(nullable(number()))],
    totalTemporaryBlockCardsByCustomer: [
      'TotalTemporaryBlockCardsByCustomer',
      optional(nullable(number())),
    ],
    totalTemporaryBlockCardsByShell: [
      'TotalTemporaryBlockCardsByShell',
      optional(nullable(number())),
    ],
    totalNewCards: ['TotalNewCards', optional(nullable(number()))],
    totalFraudCards: ['TotalFraudCards', optional(nullable(number()))],
    totalBlockedAccounts: [
      'TotalBlockedAccounts',
      optional(nullable(number())),
    ],
    totalCancelledAccounts: [
      'TotalCancelledAccounts',
      optional(nullable(number())),
    ],
    payerTradingName: ['PayerTradingName', optional(nullable(string()))],
    status: ['Status', optional(string())],
    billingLanguage: ['BillingLanguage', optional(nullable(string()))],
    legalEntity: ['LegalEntity', optional(nullable(string()))],
    dateEstablished: ['DateEstablished', optional(nullable(string()))],
    customerClassification: [
      'CustomerClassification',
      optional(nullable(string())),
    ],
    industryClass: ['IndustryClass', optional(nullable(string()))],
    marketingSegmentation: [
      'MarketingSegmentation',
      optional(nullable(string())),
    ],
    lineOfBusiness: ['LineOfBusiness', optional(nullable(string()))],
    printCreditLimit: ['PrintCreditLimit', optional(boolean())],
    cardGroupType: ['CardGroupType', optional(nullable(string()))],
    renewCards: ['RenewCards', optional(boolean())],
    allowSelectPIN: ['AllowSelectPIN', optional(boolean())],
    useFleetPIN: ['UseFleetPIN', optional(boolean())],
    vATRegNumber: ['VATRegNumber', optional(nullable(string()))],
    vATRegNumber2: ['VATRegNumber2', optional(string())],
    registrationNumber: ['RegistrationNumber', optional(nullable(string()))],
    registrationNumber2: ['RegistrationNumber2', optional(nullable(string()))],
    salesLedgerBalance: ['SalesLedgerBalance', optional(nullable(number()))],
    exposure: ['Exposure', optional(nullable(number()))],
    outstandingDebt: ['OutstandingDebt', optional(nullable(number()))],
    availableCredit: ['AvailableCredit', optional(nullable(number()))],
    band: ['Band', optional(nullable(string()))],
    globalCustomerReferenceId: [
      'GlobalCustomerReferenceId',
      optional(nullable(string())),
    ],
    creditLimit: ['CreditLimit', optional(nullable(number()))],
    creditLimitInCustomerCurrency: [
      'CreditLimitInCustomerCurrency',
      optional(nullable(number())),
    ],
    billingCurrencyCode: ['BillingCurrencyCode', optional(nullable(string()))],
    billingCurrencySymbol: [
      'BillingCurrencySymbol',
      optional(nullable(string())),
    ],
    paymentMethod: ['PaymentMethod', optional(nullable(string()))],
    paymentTerms: ['PaymentTerms', optional(nullable(string()))],
    temporaryCreditLimitIncrease: [
      'TemporaryCreditLimitIncrease',
      optional(nullable(number())),
    ],
    temporaryCreditLimitIncreaseInCustomerCurrency: [
      'TemporaryCreditLimitIncreaseInCustomerCurrency',
      optional(nullable(number())),
    ],
    temporaryCreditLimitExpiryDate: [
      'TemporaryCreditLimitExpiryDate',
      optional(nullable(string())),
    ],
    payerBankAccount: ['PayerBankAccount', optional(array(bankAccountSchema))],
    cardDeliveryAddress: ['CardDeliveryAddress', optional(addressSchema)],
    correspondanceAddress: ['CorrespondanceAddress', optional(addressSchema)],
    billingAddress: ['BillingAddress', optional(addressSchema)],
    hasActiveVolBasedPricing: ['HasActiveVolBasedPricing', optional(boolean())],
    hasActiveVolBasedBonus: ['HasActiveVolBasedBonus', optional(boolean())],
    hasActiveVolBasedAssociationBonus: [
      'HasActiveVolBasedAssociationBonus',
      optional(boolean()),
    ],
    financeCurrency: ['FinanceCurrency', optional(financeCurrency2Schema)],
    tollsCustomerId: ['TollsCustomerId', optional(nullable(string()))],
    tollsColcoCountryTypeId: [
      'TollsColcoCountryTypeId',
      optional(nullable(string())),
    ],
    contracts: ['Contracts', optional(array(customerContractSchema))],
  })
);
