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

import { boolean, number, object, optional, Schema, string } from '../schema';

export interface AccountVelocityLimit {
  /**
   * Type of velocity (COUNT type is not present for limits of PERTRX period
   * Possible Values: VALUE, VOLUME, COUNT
   */
  type?: string;
  /**
   * Duration of the velocity or threshold alert.
   * Possible Values: DAILY, WEEKLY, MONTHLY, ANNUAL, LIFETIME, PERTRX
   */
  period?: string;
  /**
   * The limit associated with this velocity with the correct number of digits after the decimal point according to the minor denomination of the currency of the card issuer.
   * Example: 1500.55
   */
  limit?: number;
  /**
   * The transaction accumulation during the current period with the correct number of digits after the decimal point according to the minor denomination of the currency of the card issuer (except for COUNT type velocity). Not present for PERTRX period.
   * Example: 1100.55
   */
  accumulation?: number;
  /**
   * The remaining/available balance at this point in time with the correct number of digits after the decimal point according to the minor denomination of the currency of the card issuer (except for COUNT type velocity). Not present for PERTRX period.
   * Example: 400.55
   */
  balance?: number;
  /**
   * Indicate if the limit is overridden or default. (false for default).
   * Example: false
   */
  override?: boolean;
  /**
   * The reference group name for product differentiated velocities. This field cannot be used with Volume type velocity.
   * Example: RoadSvc
   * This is an optional output field.
   */
  productGroup?: string;
  /**
   * The limit to trigger an alert if the balance after a transaction reaches it or below. 0 indicates no alerts will be sent. Not present if not set (issuer value threshold limit applies if available). Not present for COUNT type velocity.
   * Example: 50.55
   * This is an optional output field.
   */
  threshold?: number;
}

export const accountVelocityLimitSchema: Schema<AccountVelocityLimit> = object({
  type: ['Type', optional(string())],
  period: ['Period', optional(string())],
  limit: ['Limit', optional(number())],
  accumulation: ['Accumulation', optional(number())],
  balance: ['Balance', optional(number())],
  override: ['Override', optional(boolean())],
  productGroup: ['ProductGroup', optional(string())],
  threshold: ['Threshold', optional(number())],
});
