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

import { array, lazy, number, object, optional, Schema } from '../schema.js';
import {
  CreateCardGroupResponseErrorCardsItems,
  createCardGroupResponseErrorCardsItemsSchema,
} from './createCardGroupResponseErrorCardsItems.js';
import {
  CreateCardGroupResponseSuccessfulRequestsItems,
  createCardGroupResponseSuccessfulRequestsItemsSchema,
} from './createCardGroupResponseSuccessfulRequestsItems.js';

export interface CreateCardGroupResponse {
  /**
   * Reference number for tracking the execution of the requests – new Card Group creation and to move the cards to the new card group.
   * Reference number will be null when the validations of new card group parameters fail.
   */
  mainReference?: number;
  /**
   * Reference number for tracking the execution of card group creation.
   * Reference number will be null when the validations of new card group parameters fail.
   */
  newCardGroupReference?: number;
  /** List of cards validated and submitted successfully for processing. */
  successfulRequests?: CreateCardGroupResponseSuccessfulRequestsItems[];
  /**
   * List of cards that failed validation and not submitted for processing.
   * Entity: FailedCardReference
   * This list will be empty when the validations of new card group parameters fail.
   */
  errorCards?: CreateCardGroupResponseErrorCardsItems[];
}

export const createCardGroupResponseSchema: Schema<CreateCardGroupResponse> = lazy(
  () =>
    object({
      mainReference: ['MainReference', optional(number())],
      newCardGroupReference: ['NewCardGroupReference', optional(number())],
      successfulRequests: [
        'SuccessfulRequests',
        optional(array(createCardGroupResponseSuccessfulRequestsItemsSchema)),
      ],
      errorCards: [
        'ErrorCards',
        optional(array(createCardGroupResponseErrorCardsItemsSchema)),
      ],
    })
);
