/**
 * 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.js';
import {
  CardDayTimeRestrictions,
  cardDayTimeRestrictionsSchema,
} from './cardDayTimeRestrictions.js';
import {
  CardUsageRestrictions,
  cardUsageRestrictionsSchema,
} from './cardUsageRestrictions.js';

export interface CartTypeAccount {
  /** Account Id of the customer. */
  accountId?: number | null;
  /** Account Number of the customer. */
  accountNumber?: string;
  /** Whether card type is default or not. */
  isDefault?: boolean;
  /** Customer Card Type Id in Cards Platform. */
  customerCardTypeId?: number;
  /** True/False – Whether the card type can be used for card ordering. <br><br> Note - IsVisibleToCustomers will be set as ‘false’ when the card type is not active or. configured in MS to be not visible. */
  isVisibleToCustomers?: boolean;
  /** Default Name to be embossed on the card. */
  embossAccountName?: string;
  /** Default Purchase category of the card type. */
  defaultPurchaseCategoryId?: number;
  usageRestrictions?: CardUsageRestrictions;
  dayTimeRestrictions?: CardDayTimeRestrictions;
}

export const cartTypeAccountSchema: Schema<CartTypeAccount> = lazy(() =>
  object({
    accountId: ['AccountId', optional(nullable(number()))],
    accountNumber: ['AccountNumber', optional(string())],
    isDefault: ['IsDefault', optional(boolean())],
    customerCardTypeId: ['CustomerCardTypeId', optional(number())],
    isVisibleToCustomers: ['IsVisibleToCustomers', optional(boolean())],
    embossAccountName: ['EmbossAccountName', optional(string())],
    defaultPurchaseCategoryId: [
      'DefaultPurchaseCategoryId',
      optional(number()),
    ],
    usageRestrictions: [
      'UsageRestrictions',
      optional(cardUsageRestrictionsSchema),
    ],
    dayTimeRestrictions: [
      'DayTimeRestrictions',
      optional(cardDayTimeRestrictionsSchema),
    ],
  })
);
