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

import { lazy, object, Schema, string } from '../schema';
import {
  AccountAccessStatusEnum,
  accountAccessStatusEnumSchema,
} from './accountAccessStatusEnum';
import { Consent, consentSchema } from './consent';

export interface AccountAccessConsentResponseModel {
  /** Unique identification as assigned to identify the account access consent. */
  consentId: string;
  /** Specifies the status of the account access consent. */
  status: AccountAccessStatusEnum;
  /**
   * Date and time at which the consent was created.
   * All dates in the JSON payloads are represented in ISO 8601 date-time format.
   * All date-time fields in responses must include the timezone. An example is below:
   * 2017-04-05T10:43:07+00:00
   */
  creationDateTime: string;
  /**
   * Date and time at which the consent status was updated.
   * All dates in the JSON payloads are represented in ISO 8601 date-time format.
   * All date-time fields in responses must include the timezone. An example is below:
   * 2017-04-05T10:43:07+00:00
   */
  statusUpdateDateTime: string;
  /** Contains the requested consent */
  consent: Consent;
}

export const accountAccessConsentResponseModelSchema: Schema<AccountAccessConsentResponseModel> = object(
  {
    consentId: ['ConsentId', string()],
    status: ['Status', accountAccessStatusEnumSchema],
    creationDateTime: ['CreationDateTime', string()],
    statusUpdateDateTime: ['StatusUpdateDateTime', string()],
    consent: ['Consent', lazy(() => consentSchema)],
  }
);
