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

import { array, lazy, object, optional, Schema, string } from '../schema';
import { Address5, address5Schema } from './address5';
import { Amount1, amount1Schema } from './amount1';
import { Customer1, customer1Schema } from './customer1';
import { Dimension1, dimension1Schema } from './dimension1';
import { Event, eventSchema } from './event';
import { Expectation, expectationSchema } from './expectation';
import { OldStatus, oldStatusSchema } from './oldStatus';
import { ProductOptions, productOptionsSchema } from './productOptions';
import { Status, statusSchema } from './status';

export interface Shipment1 {
  /** The main barcode of the shipment */
  mainBarcode?: string;
  /** The barcode of the shipment */
  barcode?: string;
  /** The amount of parcels in the multi-collo shipment */
  shipmentAmount?: string;
  /** The sequence of this parcel in the multi-collo shipment */
  shipmentCounter?: string;
  customer?: Customer1;
  /** The product code of the shipment */
  productCode?: string;
  /** The description of the product code */
  productDescription?: string;
  /** The customer reference belonging to the shipment */
  reference?: string;
  /** The expected delivery date of the shipment */
  deliveryDate?: string;
  dimension?: Dimension1;
  /** The amounts belonging to the shipment */
  amount?: Amount1;
  /** A list of addresses belonging to the shipment */
  address?: Address5[];
  /** The events of the shipment. (see the [Event Codes](#tag/TandT-status-codes/Event-codes) for possible values. */
  event?: Event[];
  /** The expected delivery timeframe */
  expectation?: Expectation;
  /** A list of product options. */
  productOptions?: ProductOptions;
  /** The current status of the shipment (see the [Status codes](#tag/TandT-status-codes/Status-codes) for possible values. */
  status?: Status;
  /** A list of previous status codes (see the [Status codes](#tag/TandT-status-codes/Status-codes) for possible values. */
  oldStatus?: OldStatus[];
}

export const shipment1Schema: Schema<Shipment1> = object({
  mainBarcode: ['MainBarcode', optional(string())],
  barcode: ['Barcode', optional(string())],
  shipmentAmount: ['ShipmentAmount', optional(string())],
  shipmentCounter: ['ShipmentCounter', optional(string())],
  customer: ['Customer', optional(lazy(() => customer1Schema))],
  productCode: ['ProductCode', optional(string())],
  productDescription: ['ProductDescription', optional(string())],
  reference: ['Reference', optional(string())],
  deliveryDate: ['DeliveryDate', optional(string())],
  dimension: ['Dimension', optional(lazy(() => dimension1Schema))],
  amount: ['Amount', optional(lazy(() => amount1Schema))],
  address: ['Address', optional(array(lazy(() => address5Schema)))],
  event: ['Event', optional(array(lazy(() => eventSchema)))],
  expectation: ['Expectation', optional(lazy(() => expectationSchema))],
  productOptions: [
    'ProductOptions',
    optional(lazy(() => productOptionsSchema)),
  ],
  status: ['Status', optional(lazy(() => statusSchema))],
  oldStatus: ['OldStatus', optional(array(lazy(() => oldStatusSchema)))],
});
