/**
 * 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 { Option1Enum, option1EnumSchema } from './option1Enum';
import { Sustainability, sustainabilitySchema } from './sustainability';

export interface Timeframe {
  /** Format hh:mm:ss */
  from?: string;
  /** Format hh:mm:ss */
  to?: string;
  /** The delivery options applicable to the timeframe information. See [Delivery Options](#tag/Reference-codes/Delivery-options) for possible values. */
  options?: Option1Enum[];
  /** The date when you need to deliver the shipment to PostNL to ensure the expected delivery date is achieved. Will be returned as 'null' if not calculated */
  shippingDate?: string;
  /** Sustainability score; see [Sustainability codes](#tag/Reference-codes/Sustainability-codes) for possible values. */
  sustainability?: Sustainability;
}

export const timeframeSchema: Schema<Timeframe> = object({
  from: ['From', optional(string())],
  to: ['To', optional(string())],
  options: ['Options', optional(array(option1EnumSchema))],
  shippingDate: ['ShippingDate', optional(string())],
  sustainability: [
    'Sustainability',
    optional(lazy(() => sustainabilitySchema)),
  ],
});
