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

import {
  array,
  lazy,
  number,
  object,
  optional,
  Schema,
  string,
} from '../schema';
import { ErrorDetails, errorDetailsSchema } from './errorDetails';
import { SubmittedCard, submittedCardSchema } from './submittedCard';

export interface UpdateCardStatusResponse {
  /** Unique request identifier passed from end user. This identifier helps in tracing a transaction */
  requestId?: string;
  /** Indicates overall status of the request. Allowed values: SUCCESS, FAILED, PARTIAL_SUCCESS */
  status?: string;
  data?: SubmittedCard[];
  /** Update status reference number for tracking the execution of the request. <br>Note: Reference will be empty for status 9006 and 9012 i.e., request for all the cards failed. */
  mainReference?: number;
  /** Order replacement reference number for tracking the execution of the order replacement cards request. <br/>Note: Reference will be empty for status 9006 and 9012 i.e., request for all the cards failed or if there were no order replacement requested in the input. */
  orderReplacementReference?: number;
  errors?: ErrorDetails[];
}

export const updateCardStatusResponseSchema: Schema<UpdateCardStatusResponse> = object(
  {
    requestId: ['RequestId', optional(string())],
    status: ['Status', optional(string())],
    data: ['Data', optional(array(lazy(() => submittedCardSchema)))],
    mainReference: ['MainReference', optional(number())],
    orderReplacementReference: [
      'OrderReplacementReference',
      optional(number()),
    ],
    errors: ['Errors', optional(array(lazy(() => errorDetailsSchema)))],
  }
);
