/**
 * 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 {
  UpdateCardGroupResponseMoveCardReferencesItems,
  updateCardGroupResponseMoveCardReferencesItemsSchema,
} from './updateCardGroupResponseMoveCardReferencesItems.js';

export interface UpdateCardGroupResponse {
  /**
   * Reference number for tracking the overall request.
   * The value will be null when the validation fails.
   */
  mainReference?: number;
  /**
   * Reference number for tracking the execution of terminate card-group request.
   * Reference number will be null when the validations fail or TerminateCardGroup in the request object is false.
   */
  updateCardGroupReference?: number;
  /**
   * Reference number for tracking the execution of new card group creation in the case when the cards in the terminating card-group have to be moved to a new card-group.
   * Reference number will be null when the validations fail or new card-group creation is not requested.
   */
  newCardGroupReference?: number;
  /**
   * List of cards submitted successfully for processing the move to the target card-group or to change card-group to null.
   * This list will be empty when the validations fail or there are no cards in the card-group that is getting terminated or MoveCards in the request object is false
   */
  moveCardReferences?: UpdateCardGroupResponseMoveCardReferencesItems[];
}

export const updateCardGroupResponseSchema: Schema<UpdateCardGroupResponse> = lazy(
  () =>
    object({
      mainReference: ['MainReference', optional(number())],
      updateCardGroupReference: [
        'UpdateCardGroupReference',
        optional(number()),
      ],
      newCardGroupReference: ['NewCardGroupReference', optional(number())],
      moveCardReferences: [
        'MoveCardReferences',
        optional(array(updateCardGroupResponseMoveCardReferencesItemsSchema)),
      ],
    })
);
