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

import { object, optional, Schema, string } from '../schema';
import { ErrorCodeEnum, errorCodeEnumSchema } from './errorCodeEnum';

export interface Error {
  /** Low level textual error code. */
  errorCode: ErrorCodeEnum;
  /** A free text description of the error that occurred. E.g., 'A mandatory field isn't supplied'. */
  message: string;
  /** A recommended but optional reference to the JSON Path of the field with error, e.g., Data.Consent.InstructedAmount.Currency */
  path?: string;
  /** URL to help remediate the problem, provide more information or to API Reference. */
  url?: string;
}

export const errorSchema: Schema<Error> = object({
  errorCode: ['ErrorCode', errorCodeEnumSchema],
  message: ['Message', string()],
  path: ['Path', optional(string())],
  url: ['Url', optional(string())],
});
