/**
 * Account and Transaction API SpecificationLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { lazy, object, Schema } from '../schema';
import { Amount, amountSchema } from './amount';
import {
  BalanceModelTypeEnum,
  balanceModelTypeEnumSchema,
} from './balanceModelTypeEnum';
import {
  CreditDebitIndicatorEnum,
  creditDebitIndicatorEnumSchema,
} from './creditDebitIndicatorEnum';

/** Set of elements used to define the balance as a numerical representation of the net increases and decreases in an account after a transaction entry is applied to the account. */
export interface Balance {
  /** Amount of money of the cash balance. */
  amount: Amount;
  /** Indicates whether the balance is a credit or a debit balance. Usage: A zero balance is considered to be a credit balance. */
  creditDebitIndicator: CreditDebitIndicatorEnum;
  /** Balance type, in a coded form. */
  type: BalanceModelTypeEnum;
}

export const balanceSchema: Schema<Balance> = object({
  amount: ['Amount', lazy(() => amountSchema)],
  creditDebitIndicator: [
    'CreditDebitIndicator',
    creditDebitIndicatorEnumSchema,
  ],
  type: ['Type', balanceModelTypeEnumSchema],
});
