/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { lazy, object, Schema, string } from '../schema';
import { CreditorAccount1, creditorAccount1Schema } from './creditorAccount1';
import { CreditorAgent1, creditorAgent1Schema } from './creditorAgent1';
import {
  FinalPaymentAmount,
  finalPaymentAmountSchema,
} from './finalPaymentAmount';
import {
  FirstPaymentAmount,
  firstPaymentAmountSchema,
} from './firstPaymentAmount';
import {
  NextPaymentAmount,
  nextPaymentAmountSchema,
} from './nextPaymentAmount';
import { Reference, referenceSchema } from './reference';

export interface StandingOrder {
  accountId: string;
  frequency: string;
  nextPaymentDateTime: string;
  nextPaymentAmount: NextPaymentAmount;
  standingOrderId: string;
  reference: Reference;
  firstPaymentAmount: FirstPaymentAmount;
  finalPaymentAmount: FinalPaymentAmount;
  firstPaymentDateTime: string;
  finalPaymentDateTime: string;
  creditorAccount: CreditorAccount1;
  creditorAgent: CreditorAgent1;
}

export const standingOrderSchema: Schema<StandingOrder> = object({
  accountId: ['AccountId', string()],
  frequency: ['Frequency', string()],
  nextPaymentDateTime: ['NextPaymentDateTime', string()],
  nextPaymentAmount: ['NextPaymentAmount', lazy(() => nextPaymentAmountSchema)],
  standingOrderId: ['StandingOrderId', string()],
  reference: ['Reference', lazy(() => referenceSchema)],
  firstPaymentAmount: [
    'FirstPaymentAmount',
    lazy(() => firstPaymentAmountSchema),
  ],
  finalPaymentAmount: [
    'FinalPaymentAmount',
    lazy(() => finalPaymentAmountSchema),
  ],
  firstPaymentDateTime: ['FirstPaymentDateTime', string()],
  finalPaymentDateTime: ['FinalPaymentDateTime', string()],
  creditorAccount: ['CreditorAccount', lazy(() => creditorAccount1Schema)],
  creditorAgent: ['CreditorAgent', lazy(() => creditorAgent1Schema)],
});
