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

import { lazy, number, object, optional, Schema, string } from '../schema';
import { Address1, address1Schema } from './address1';
import { OpeningHours, openingHoursSchema } from './openingHours';
import { Sustainability, sustainabilitySchema } from './sustainability';

export interface Location {
  /** The pickup location address */
  address?: Address1;
  /** Time from when the parcel can be retrieved at the pickup location */
  pickupTime?: string;
  /** The standard opening hours of the pickup location */
  openingHours?: OpeningHours;
  /** The calculated distance (in meters) between the location specified and the address provided in the request */
  distance?: number;
  /** The location identifier */
  locationCode?: string;
  /** The partner identifier; not used anymore */
  partnerID?: string;
  /** Sustainability score; see [Sustainability codes](#tag/Reference-codes/Sustainability-codes) for possible values. */
  sustainability?: Sustainability;
}

export const locationSchema: Schema<Location> = object({
  address: ['Address', optional(lazy(() => address1Schema))],
  pickupTime: ['PickupTime', optional(string())],
  openingHours: ['OpeningHours', optional(lazy(() => openingHoursSchema))],
  distance: ['Distance', optional(number())],
  locationCode: ['LocationCode', optional(string())],
  partnerID: ['PartnerID', optional(string())],
  sustainability: [
    'Sustainability',
    optional(lazy(() => sustainabilitySchema)),
  ],
});
