/**
 * 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 { Address, addressSchema } from './address';
import {
  DeliveryAddresses,
  deliveryAddressesSchema,
} from './deliveryAddresses';
import { ErrorStatus, errorStatusSchema } from './errorStatus';
import { PINAdviceTypes, pINAdviceTypesSchema } from './pINAdviceTypes';

export interface CustomerDetailResponse {
  /** Account Id of the selected account. */
  accountId?: number | null;
  /** Account Name of the selected account. */
  accountName?: string | null;
  /** Account Number of the selected account. */
  accountNumber?: string | null;
  /** Short name of the customer. */
  accountShortName?: string | null;
  /** Trading name of the customer */
  accountTradingName?: string | null;
  /**
   * True/False.
   * When false, users should not be allowed to enable Fleet Id prompt option while ordering cards under this account.
   */
  allowFleetIdInput?: boolean;
  /**
   * 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;
  billingAddress?: Address;
  /**
   * Card group position at –
   * •    Payer – Payer level
   * •    Account – Account level
   */
  cardGroupPosition?: string | null;
  correspondenceAddress?: Address;
  deliveryAddresses?: DeliveryAddresses[];
  /** Is Fleet Pin optional enabled for the selected account */
  fleetPin?: boolean;
  /** Full Name of the customer */
  fullName?: string | null;
  /** Customer Id of the Invoice Point of the account */
  invoiceCustomerId?: number | null;
  /** Short Name of the Invoice Point of the account */
  invoiceCustomerShortName?: string | null;
  /** Whether the account is an invoice point. */
  isInvoicePoint?: boolean | null;
  /**
   * Marketing Segmentation id and description
   * e.g. (Id – Description):
   * 1-National CRT
   * 2-International CRT & IKAs
   * 3-Small Customers
   * 4-National/International Fleet/IKA
   */
  marketingSegmentation?: string | null;
  /** VAT Registration Number of Customer */
  vATNumber?: string | null;
  /** Payer Id of the selected account. */
  payerId?: number | null;
  /** Payer Name of the selected account. */
  payerName?: string | null;
  /** Payer Number of the selected account. */
  payerNumber?: string | null;
  /** Is Self-selected Pin enabled for the account */
  selfSelectedPin?: boolean | 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 | null;
  /**
   * Default PIN AdviceType of the customer.
   * Possible Values:
   * 1.    Paper
   * 2.    Email
   * 3.    SMS
   * 4.    None
   */
  defaultPINAdviceType?: number | null;
  pINAdviceTypes?: PINAdviceTypes[];
  error?: ErrorStatus;
  /** API Request id */
  requestId?: string | null;
  /** PIN change allowed for card holder or not. */
  pINChangeAllowedByCardholder?: boolean;
  /** PIN change allowed from fleetpin or not. */
  pINChangeAllowedFromFleetPIN?: boolean;
}

export const customerDetailResponseSchema: Schema<CustomerDetailResponse> = object(
  {
    accountId: ['AccountId', optional(nullable(number()))],
    accountName: ['AccountName', optional(nullable(string()))],
    accountNumber: ['AccountNumber', optional(nullable(string()))],
    accountShortName: ['AccountShortName', optional(nullable(string()))],
    accountTradingName: ['AccountTradingName', optional(nullable(string()))],
    allowFleetIdInput: ['AllowFleetIdInput', optional(boolean())],
    band: ['Band', optional(nullable(string()))],
    billingAddress: ['BillingAddress', optional(lazy(() => addressSchema))],
    cardGroupPosition: ['CardGroupPosition', optional(nullable(string()))],
    correspondenceAddress: [
      'CorrespondenceAddress',
      optional(lazy(() => addressSchema)),
    ],
    deliveryAddresses: [
      'DeliveryAddresses',
      optional(array(lazy(() => deliveryAddressesSchema))),
    ],
    fleetPin: ['FleetPin', optional(boolean())],
    fullName: ['FullName', optional(nullable(string()))],
    invoiceCustomerId: ['InvoiceCustomerId', optional(nullable(number()))],
    invoiceCustomerShortName: [
      'InvoiceCustomerShortName',
      optional(nullable(string())),
    ],
    isInvoicePoint: ['IsInvoicePoint', optional(nullable(boolean()))],
    marketingSegmentation: [
      'MarketingSegmentation',
      optional(nullable(string())),
    ],
    vATNumber: ['VATNumber', optional(nullable(string()))],
    payerId: ['PayerId', optional(nullable(number()))],
    payerName: ['PayerName', optional(nullable(string()))],
    payerNumber: ['PayerNumber', optional(nullable(string()))],
    selfSelectedPin: ['SelfSelectedPin', optional(nullable(boolean()))],
    status: ['Status', optional(nullable(string()))],
    defaultPINAdviceType: [
      'DefaultPINAdviceType',
      optional(nullable(number())),
    ],
    pINAdviceTypes: [
      'PINAdviceTypes',
      optional(array(lazy(() => pINAdviceTypesSchema))),
    ],
    error: ['Error', optional(lazy(() => errorStatusSchema))],
    requestId: ['RequestId', optional(nullable(string()))],
    pINChangeAllowedByCardholder: [
      'PINChangeAllowedByCardholder',
      optional(boolean()),
    ],
    pINChangeAllowedFromFleetPIN: [
      'PINChangeAllowedFromFleetPIN',
      optional(boolean()),
    ],
  }
);
