/**
 * 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 { Address2, address2Schema } from './address2';
import { DeliveryOptions, deliveryOptionsSchema } from './deliveryOptions';
import { OpeningHours1, openingHours1Schema } from './openingHours1';
import { Sustainability2, sustainability2Schema } from './sustainability2';

export interface Location1 {
  address?: Address2;
  /** The options belonging to the pickup location. The delivery options RETA, UL, PU, DO, BW, RT and BWUL can be shown in the response. Please ignore these codes. These codes are internal PostNL codes. */
  deliveryOptions?: DeliveryOptions;
  /** The distance from the address/coordinates provided in the request to the pickup location returned. Distance in meters. */
  distance?: number;
  /** The latitude of the pickup location */
  latitude?: number;
  /** The pickup location identifier */
  locationCode?: number;
  /** The longitude of the pickup location */
  longitude?: number;
  /** The name of the pickup location */
  name?: string;
  /** The standard opening times of the pickup location */
  openingHours?: OpeningHours1;
  /** Sustainability score; see [Sustainability codes](#tag/Reference-codes/Sustainability-codes) for possible values. */
  sustainability?: Sustainability2;
  /** The partner name belonging to the pickup location. Can be ignored, no longer used. */
  partnerName?: string;
  /** The retail network belonging to the pickup location. Can be ignored, no longer used */
  retailNetworkID?: string;
}

export const location1Schema: Schema<Location1> = object({
  address: ['Address', optional(lazy(() => address2Schema))],
  deliveryOptions: [
    'DeliveryOptions',
    optional(lazy(() => deliveryOptionsSchema)),
  ],
  distance: ['Distance', optional(number())],
  latitude: ['Latitude', optional(number())],
  locationCode: ['LocationCode', optional(number())],
  longitude: ['Longitude', optional(number())],
  name: ['Name', optional(string())],
  openingHours: ['OpeningHours', optional(lazy(() => openingHours1Schema))],
  sustainability: [
    'Sustainability',
    optional(lazy(() => sustainability2Schema)),
  ],
  partnerName: ['PartnerName', optional(string())],
  retailNetworkID: ['RetailNetworkID', optional(string())],
});
