import {z} from 'zod' export type CreateApiServicesBookingV1BookingsBookingIdCarrierNoticesArgs = {bookingId: string}; export type CreateApiServicesBookingV1BookingsBookingIdCarrierNoticesOptions = {baseUrl?: string | undefined, oAuth2?: string | undefined, fetch?: typeof fetch | undefined}; export const customAttribute = z.object({name: z.string().min(1).max(255).optional(), value: z.string().min(1).max(255).optional(), values: z.array(z.string().min(1).max(255)).optional()}); export const apiConfiguration = z.object({bookingWebhookName: z.string().optional()}); export const automatedFailureReason = z.enum(["ERROR_CREDENTIALS", "NO_RESPONSE_CARRIER", "INTERNAL_ERROR_CARRIER", "UNKNOWN_ERROR_CARRIER", "INTERNAL_ERROR_VCS", "UNKNOWN_ERROR_VCS", "UNSUPPORTED_EQUIPMENT_TYPE", "UNSUPPORTED_MODE", "UNSUPPORTED_COUNTRY", "UNSUPPORTED_STOP_TYPE", "MISSING_DATA", "INVALID_DATA"]); export const bookingSourceMethod = z.enum(["API", "WEBAPP"]); export const capacityProviderIdentifierType = z.enum(["FFW_SCAC", "CARRIER_SCAC", "DOT_NUMBER", "MC_NUMBER", "P44_EU", "SYSTEM", "P44_GLOBAL"]); export const bookingCapacityProviderIdentifier = z.object({type: capacityProviderIdentifierType.optional(), value: z.string().optional()}); export const bookingContact = z.object({companyName: z.string().optional(), email: z.string().optional(), familyName: z.string().optional(), givenName: z.string().optional(), mobilePhoneNumber: z.string().optional(), phoneNumber: z.string().optional()}); export const currency = z.enum(["USD", "CAD", "MXN", "EUR"]); export const linehaulCharge = z.object({amount: z.number().optional(), currency: currency.optional(), code: z.literal("LINEHAUL").optional()}); export const fuelSurchargeCalculationMethod = z.enum(["PER_MILE", "PER_KILOMETER"]); export const fuelSurchargeKind = z.object({distance: z.number().optional(), rateType: fuelSurchargeCalculationMethod.optional(), ratePerDistanceUnit: z.number().optional()}); export const fuelSurchargeCharge = z.object({amount: z.number().optional(), currency: currency.optional(), code: z.literal("FUEL_SURCHARGE").optional(), details: fuelSurchargeKind.optional()}); export const dropOffSurchargeKind = z.object({chargePerStop: z.number().optional(), numberOfStops: z.number().int().gte(1).optional()}); export const dropOffSurchargeCharge = z.object({amount: z.number().optional(), currency: currency.optional(), code: z.literal("DROP_OFF_SURCHARGE").optional(), details: dropOffSurchargeKind.optional()}); export const accessorialChargeCode = z.enum(["DETENTION_PICKUP", "DETENTION_DELIVERY", "LIFT_GATE_PICKUP", "LIFT_GATE_DELIVERY", "RESIDENTIAL_PICKUP", "RESIDENTIAL_DELIVERY", "INSIDE_PICKUP", "INSIDE_DELIVERY", "LIMITED_ACCESS_PICKUP", "LIMITED_ACCESS_DELIVERY", "APPOINTMENT_PICKUP", "APPOINTMENT_DELIVERY", "LAYOVER", "TRUCK_ORDERED_NOT_USED", "REDELIVERY", "ADDITIONAL_LINEHAUL"]); export const accessorialChargeKind = z.object({type: accessorialChargeCode.optional()}); export const accessorialCharge = z.object({amount: z.number().optional(), currency: currency.optional(), code: z.literal("ACCESSORIAL_CHARGE").optional(), details: accessorialChargeKind.optional()}); export const otherChargeKind = z.object({description: z.string().max(500).optional(), type: z.string().max(100).optional()}); export const otherCharge = z.object({amount: z.number().optional(), currency: currency.optional(), code: z.literal("OTHER_CHARGES").optional(), details: otherChargeKind.optional()}); export const carrierResponseMethod = z.enum(["API", "EDI", "EMAIL"]); export const logisticsIdentifierTypeEnum = z.enum(["AIR_WAYBILL", "BILL_OF_LADING", "HOUSE_BILL_OF_LADING", "BOOKING_NUMBER", "CARRIER_IATA", "CARRIER_ICAO", "CARRIER_NAME", "CARRIER_SCAC", "FFW_SCAC", "NVOCC_SCAC", "NVOCC_NAME", "FFW_NAME", "FFW_MASTER_ID", "NVOCC_MASTER_ID", "CONTAINER_ID", "CUSTOMER_REFERENCE", "DELIVERY_NUMBER", "EXTERNAL", "FLIGHT_NUMBER", "ORDER", "PICKUP", "PRO", "PURCHASE_ORDER", "RAIL_CAR_ID", "RAIL_WAYBILL", "TRACKING_NUMBER", "TRAILER_ID", "UNKNOWN", "VESSEL_IMO", "VESSEL_NAME", "WAYBILL", "VESSEL_CALL_SIGN", "VESSEL_MMSI", "CARRIER_US_DOT_NUMBER", "CARRIER_MC_NUMBER", "SUBSCRIPTION_ID", "HOUSE_AIR_WAYBILL", "SALES_ORDER", "WAREHOUSE_MOVEMENT_ORDER", "ADVANCED_SHIPMENT_NOTICE", "DRIVER_MOBILE_PHONE_NUMBER", "VEHICLE_ID", "LICENSE_PLATE", "TRAILER_LICENSE_PLATE", "SENSITECH_DEVICE_ID", "EMERSON_DEVICE_ID", "TIVE_DEVICE_ID", "ZILLION_DEVICE_ID", "VOYAGE_NUMBER", "CARRIER_MASTER_ID", "CARRIER_NMC_ID", "CONTAINER_TYPE", "TRAIN_NUMBER", "WAGON_ID", "TRAIN_ID", "CAPACITY_PROVIDER_ACCOUNT_GROUP", "CAPACITY_PROVIDER_ACCOUNT_CODE", "SERIAL_NUMBER", "VEHICLE_IDENTIFICATION_NUMBER", "REFERENCE_NUMBER", "CONTAINER_PIN", "VESSEL_P44_ID", "EXPORT_CUSTOMS_BROKER", "IMPORT_CUSTOMS_BROKER", "POL_QUALITY_CONTROL_PROVIDER", "POD_QUALITY_CONTROL_PROVIDER", "AIRCRAFT_ICAO", "AIRLINE_NAME", "SEAL_NUMBER", "DRAYAGE_CARRIER_SCAC", "EXPORT_DRAYAGE_CARRIER_SCAC", "IMPORT_DRAYAGE_CARRIER_SCAC", "INBOUND_VOYAGE_NUMBER"]); export const logisticsIdentifier = z.object({type: logisticsIdentifierTypeEnum.optional(), value: z.string().min(1).optional()}); export const monetaryValue = z.object({amount: z.number().optional(), currency: currency.optional()}); export const rateIdentifierSource = z.enum(["SYSTEM", "EXTERNAL", "UNKNOWN"]); export const rateIdentifierType = z.enum(["SPOT_QUOTE", "CONTRACT"]); export const rateIdentifier = z.object({source: rateIdentifierSource.optional(), type: rateIdentifierType.optional(), value: z.string().optional()}); export const timeWindow = z.object({endTime: z.string().optional(), startTime: z.string().optional()}); export const tempUnit = z.enum(["CELSIUS", "FAHRENHEIT"]); export const tempRangeKind = z.object({min: z.number().optional(), max: z.number().optional(), unit: tempUnit.optional()}); export const refrigeratedAccessorial = z.object({code: z.literal("REFRIGERATED").optional(), details: tempRangeKind.optional()}); export const specificationKindBool = z.object({value: z.boolean().optional()}); export const liftgateAccessorial = z.object({code: z.literal("LIFTGATE").optional(), details: specificationKindBool.optional()}); export const lengthUnit = z.enum(["FT", "M", "IN", "CM", "MI", "KM"]); export const quantityKind = z.object({count: z.number().int().optional(), size: z.number().optional(), unit: lengthUnit.optional()}); export const tarpsAccessorial = z.object({code: z.literal("TARPS").optional(), details: quantityKind.optional()}); export const strapsAccessorial = z.object({code: z.literal("STRAPS").optional(), details: quantityKind.optional()}); export const chainsAccessorial = z.object({code: z.literal("CHAINS").optional(), details: quantityKind.optional()}); export const deckHeight = z.enum(["STANDARD", "DROP_DECK", "DOUBLE_DROP"]); export const specificationKindDeckHeight = z.object({value: deckHeight.optional()}); export const deckHeightAccessorial = z.object({code: z.literal("DECK_HEIGHT").optional(), details: specificationKindDeckHeight.optional()}); export const craneAccessorial = z.object({code: z.literal("CRANE").optional(), details: specificationKindBool.optional()}); export const callBeforeArrivalAccessorial = z.object({code: z.literal("CALL_BEFORE_ARRIVAL").optional(), details: specificationKindBool.optional()}); export const dockRequiredAccessorial = z.object({code: z.literal("DOCK_REQUIRED").optional(), details: specificationKindBool.optional()}); export const lockedGateAccessorial = z.object({code: z.literal("LOCKED_GATE").optional(), details: specificationKindBool.optional()}); export const firstComeFirstServedAccessorial = z.object({code: z.literal("FIRST_COME_FIRST_SERVED").optional(), details: specificationKindBool.optional()}); export const appointmentRequiredAccessorial = z.object({code: z.literal("APPOINTMENT_REQUIRED").optional(), details: specificationKindBool.optional()}); export const whiteGloveAccessorial = z.object({code: z.literal("WHITE_GLOVE").optional(), details: specificationKindBool.optional()}); export const hazmatKind = z.object({hazmatClass: z.string().optional(), unCode: z.string().optional()}); export const hazmatAccessorial = z.object({code: z.literal("HAZMAT").optional(), details: hazmatKind.optional()}); export const excessiveLength = z.object({length: z.number().int().gte(6).lte(30).optional()}); export const specificationKindExcessiveLength = z.object({value: excessiveLength.optional()}); export const excessiveLengthAccessorial = z.object({code: z.literal("EXCESSIVE_LENGTH").optional(), details: specificationKindExcessiveLength.optional()}); export const guaranteedByHour = z.object({hour: z.number().int().gte(8).lte(14).optional(), minute: z.number().int().gte(0).lte(59).optional()}); export const specificationKindGuaranteedByHour = z.object({value: guaranteedByHour.optional()}); export const guaranteedServiceLevelAccessorial = z.object({code: z.literal("GUARANTEED").optional(), details: specificationKindGuaranteedByHour.optional()}); export const pickupAccessorials = z.enum(["NCPU", "LTDPU", "AIRPU", "CAMPPU", "CHRCPU", "CLUBPU", "CNVPU", "CONPU", "EDUPU", "FARMPU", "GOVPU", "GROPU", "HOSPU", "HOTLPU", "MILPU", "MINEPU", "NARPU", "NURSPU", "PARKPU", "PIERPU", "PRISPU", "RESPU", "RSRTPU", "SSTORPU", "UTLPU", "NBPU", "HDAYPU", "WEPU", "SATPU", "SUNPU", "APPTPU", "CERTPU", "CFSPU", "COMPU", "DVALPU", "DOCKPU", "FBEDPU", "LGPU", "INPU", "MALLPU", "OVSZEPU", "PJACKPU", "SORTPU", "XCHGPU", "XFERPU", "SHIPLDPU"]); export const deliveryAccessorials = z.enum(["NCDEL", "LTDDEL", "AIRDEL", "CAMPDEL", "CHRCDEL", "CLUBDEL", "CNVDEL", "CONDEL", "EDUDEL", "FARMDEL", "GOVDEL", "GRODEL", "HOSDEL", "HOTLDEL", "MILDEL", "MINEDEL", "NARDEL", "NURSDEL", "PARKDEL", "PIERDEL", "PRISDEL", "SSTORDEL", "UTLDEL", "NBDEL", "AFTRHRDEL", "HDAYDEL", "WEDEL", "SATDEL", "SUNDEL", "APPTDEL", "NOTIFY", "INDEL", "INEDEL", "INGDEL", "INNEDEL", "UNLOADDEL", "COMDEL", "DCDEL", "CFSDEL", "DOCKDEL", "DVALDEL", "EMERGENCYDEL", "FBEDDEL", "LGDEL", "MALLDEL", "OVSZEDEL", "PJACKDEL", "RESDEL", "RSRTDEL", "SORTDEL", "TWOMAN", "XCHGDEL", "XFERDEL", "CSNLDDEL"]); export const nonSpecificAccessorials = z.enum(["EXPEDITE", "EXPEDITE17", "EXPEDITEAM", "GURWIN", "GSSING", "GSMUL", "GSFM", "GS8", "GS9", "GS10", "GS11", "GSAM", "GS14", "GS15", "GS1530", "GUR", "ACCELERATED", "CAPLOAD", "CNTER20", "CNTER40", "CNTER40H", "CNTER45", "CNTER53", "CAPLOADTRA", "CAPLOADPUP", "CHASSIS", "FLTTRCK", "TANK", "OPENTOP", "STRAIGHT", "HOLIWEEK", "WESER", "AFTRHR", "CHNGBOL", "CORBOL", "REEFER", "FRIDGE", "PFH", "MAINTEMP", "HEAT", "PFZ", "PFZC", "PROTECT", "PROTECTDRM", "PROTECTPAL", "FRZABLE", "HAZM", "POISON", "LOAD", "LOADCNT", "LOADUNLOAD", "DRASST", "UNPCK", "UNLOAD", "UNLOADCNT", "O750U6", "OVDIM", "OVERWGHT", "REG", "INT", "IREG", "BYDIND", "TSAC", "HMLAND", "SECINS", "ADVCOL", "CONSOL", "DESCINS", "DLYCHRG", "INBND", "RMVDEB", "TARP", "TCKNU", "PRMIT", "WINSPC", "WVERI", "XTRLBR", "AIR", "AIRBAG", "BAGLINER", "BOBTAIL", "CRANE", "CROSS", "DROPPULL", "FORK", "LABEL", "LIQUOR", "PALLET", "SIGN", "SPECIALEQUIP", "ARCHR", "BLIND", "BOND", "BULKHEAD", "CANFEE", "COD", "CREDEL", "DET", "DRAY", "DRYRU", "EV", "EXPORT", "FOOD", "HAWAII", "HOMEMOVE", "HIGHDOCK", "IMPORT", "LUMPER", "LYOVR", "MARKING", "OILSANDS", "RECON", "SEADOC", "SINGSHIP", "STORAGE", "STPOFF", "TMCHG", "WHITEGLOVE"]); export const excessLengthAccessorials = z.enum(["ELS_6", "ELS_7", "ELS_8", "ELS_9", "ELS_10", "ELS_11", "ELS_12", "ELS_13", "ELS_14", "ELS_15", "ELS_16", "ELS_17", "ELS_18", "ELS_19", "ELS_20", "ELS_21", "ELS_22", "ELS_23", "ELS_24", "ELS_25", "ELS_26", "ELS_27", "ELS_28", "ELS_29", "ELS_30"]); export const otherAccessorial = z.object({code: z.union([pickupAccessorials, deliveryAccessorials, nonSpecificAccessorials, excessLengthAccessorials]).optional()}); export const countryCode = z.enum(["US", "CA", "MX", "AG", "BB", "BS", "BZ", "CR", "CU", "DM", "DO", "GD", "GT", "HN", "HT", "JM", "KN", "LC", "NI", "PA", "SV", "TT", "VC", "AI", "AW", "BL", "BM", "BQ", "CW", "GL", "GP", "KY", "MF", "MQ", "MS", "PM", "PR", "SX", "TC", "UM", "VG", "VI", "AT", "BE", "BG", "CY", "CZ", "DK", "DE", "EE", "ES", "FI", "FR", "GB", "GR", "HR", "HU", "IE", "IT", "LT", "LU", "LV", "MT", "NL", "PL", "PT", "RO", "SE", "SK", "SI", "CH", "IS", "LI", "NO", "AL", "ME", "MK", "RS", "TR", "AD", "AX", "BA", "BV", "BY", "FO", "GG", "GI", "IM", "IO", "JE", "MC", "MD", "SJ", "SM", "TF", "UA", "VA", "AE", "AF", "AM", "AZ", "BD", "BH", "BN", "BT", "CN", "GE", "HK", "ID", "IL", "IN", "IQ", "IR", "JO", "JP", "KG", "KH", "KP", "KR", "KW", "KZ", "LA", "LB", "LK", "MM", "MN", "MO", "MV", "MY", "NP", "OM", "PH", "PK", "PS", "QA", "RU", "SA", "SG", "SY", "TH", "TJ", "TL", "TM", "TW", "UZ", "VN", "YE", "AO", "BF", "BI", "BJ", "BW", "CD", "CF", "CG", "CI", "CM", "CV", "DJ", "DZ", "EG", "EH", "ER", "ET", "GA", "GH", "GM", "GN", "GQ", "GW", "HM", "KE", "KM", "LR", "LS", "LY", "MA", "MG", "ML", "MR", "MU", "MW", "MZ", "NA", "NE", "NG", "RE", "RW", "SC", "SD", "SH", "SL", "SN", "SO", "SS", "ST", "SZ", "TD", "TG", "TN", "TZ", "UG", "YT", "ZA", "ZM", "ZW", "AR", "BO", "BR", "CL", "CO", "EC", "FK", "GF", "GS", "GY", "PE", "PY", "SR", "UY", "VE", "AS", "AU", "CC", "CK", "CX", "FJ", "FM", "GU", "KI", "MH", "MP", "NC", "NF", "NR", "NU", "NZ", "PF", "PG", "PN", "PW", "SB", "TK", "TO", "TV", "VU", "WF", "WS", "AQ", "EL", "UK", "XK", "XS", "XI"]); export const address = z.object({addressLines: z.array(z.string()).optional(), city: z.string().optional(), country: countryCode.optional(), postalCode: z.string().optional(), state: z.string().optional()}); export const geoCoordinates = z.object({latitude: z.number().optional(), longitude: z.number().optional()}); export const locationIdentifierType = z.enum(["UNKNOWN", "AIRPORT_IATA", "AIRPORT_ICAO", "PORT_UN_LOCODE", "RAIL_SPLC", "DATA_PROVIDER_LOCATION_CODE", "LOCODE"]); export const bookingLocationIdentifier = z.object({type: locationIdentifierType.optional(), value: z.string().optional()}); export const bookingLocation = z.object({address: address.optional(), geoCoordinates: geoCoordinates.optional(), id: z.string().optional(), identifiers: z.array(bookingLocationIdentifier).optional(), name: z.string().optional(), timeZone: z.string().optional()}); export const loadingMethod = z.enum(["LIVE", "DROP"]); export const stopType = z.enum(["PICKUP", "DELIVERY", "PICKUP_DELIVERY", "PORT_OF_LOADING", "PORT_OF_DISCHARGE", "TRANSSHIPMENT_PORT"]); export const stop = z.object({arrivalDate: z.string().optional(), arrivalAppointmentWindow: timeWindow.optional(), accessorials: z.array(z.union([refrigeratedAccessorial, liftgateAccessorial, tarpsAccessorial, strapsAccessorial, chainsAccessorial, deckHeightAccessorial, craneAccessorial, callBeforeArrivalAccessorial, dockRequiredAccessorial, lockedGateAccessorial, firstComeFirstServedAccessorial, appointmentRequiredAccessorial, whiteGloveAccessorial, hazmatAccessorial, excessiveLengthAccessorial, guaranteedServiceLevelAccessorial, otherAccessorial])).optional(), contacts: z.array(bookingContact).optional(), id: z.string().optional(), location: bookingLocation.optional(), loadingMethod: loadingMethod.optional(), type: stopType.optional()}); export const routeSegmentWithStops = z.object({fromStop: stop.optional(), id: z.string().optional(), toStop: stop.optional()}); export const bookingRejectionReason = z.enum(["COST_NOT_AGREED", "SHORT_ON_STAFF", "NOT_WITHIN_SCOPE", "TRANSIT_TIME_TOO_SHORT", "REQUESTED_EQUIPMENT_NOT_AVAILABLE", "OTHER"]); export const dimensions = z.object({height: z.number().gte(0).optional(), length: z.number().gte(0).optional(), unit: lengthUnit.optional(), width: z.number().gte(0).optional()}); export const freightClass = z.enum(["50", "55", "60", "65", "70", "77.5", "85", "92.5", "100", "110", "125", "150", "175", "200", "250", "300", "400", "500"]); export const handlingUnitType = z.enum(["BAG", "BALE", "BOX", "BUCKET", "BUNDLE", "CAN", "CARTON", "CASE", "COIL", "CRATE", "CYLINDER", "DRUM", "PAIL", "PALLET", "PIECES", "REEL", "ROLL", "SKID", "TOTE", "TUBE"]); export const hazmatPackingGroup = z.enum(["I", "II", "III", "NONE"]); export const hazmatDetail = z.object({hazardClass: z.string().optional(), identificationNumber: z.string().optional(), properShippingName: z.string().optional(), packingGroup: hazmatPackingGroup.optional()}); export const itemIdentifierType = z.enum(["CONTAINER_NUMBER", "PALLET_NUMBER", "DELIVERY_NUMBER", "PICKUP_NUMBER", "VEHICLE_IDENTIFICATION_NUMBER", "SERIAL_NUMBER", "PURCHASE_ORDER", "SALES_ORDER", "WAREHOUSE_MOVEMENT_ORDER", "ADVANCED_SHIPMENT_NOTICE", "INVOICE_NUMBER", "STOCK_KEEPING_UNIT", "UNIVERSAL_PRODUCT_CODE", "UNKNOWN"]); export const itemIdentifier = z.object({type: itemIdentifierType.optional(), value: z.string().optional()}); export const packageContainerType = z.enum(["BAG", "BALE", "BOX", "BUCKET", "BUNDLE", "CAN", "CARTON", "CASE", "COIL", "CRATE", "CYLINDER", "EACH", "FLAT", "LOOSE", "PAIL", "ROLL", "TUBE"]); export const item = z.object({description: z.string().optional(), identifiers: z.array(itemIdentifier).optional(), unitQuantity: z.number().int().optional(), unitType: packageContainerType.optional()}); export const temperatureMeasurement = z.object({unit: tempUnit.optional(), value: z.number().optional()}); export const refrigerationDetail = z.object({minimumTemperature: temperatureMeasurement.optional(), maximumTemperature: temperatureMeasurement.optional()}); export const weightUnit = z.enum(["LB", "KG"]); export const bookingWeight = z.object({unit: weightUnit.optional(), value: z.number().gte(0).optional()}); export const bookingHandlingUnit = z.object({description: z.string().optional(), dimensions: dimensions.optional(), freightClass: freightClass.optional(), handlingUnitType: handlingUnitType.optional(), hazmatDetail: hazmatDetail.optional(), items: z.array(item).optional(), monetaryValue: monetaryValue.optional(), nmfcItemCode: z.string().optional(), nmfcSubCode: z.string().optional(), quantity: z.number().int().optional(), refrigerationDetail: refrigerationDetail.optional(), stackable: z.boolean().optional(), weight: bookingWeight.optional()}); export const handlingUnitsDetails = z.object({details: z.array(bookingHandlingUnit).optional()}); export const shipmentDetails = z.object({accessorials: z.array(z.union([refrigeratedAccessorial, liftgateAccessorial, tarpsAccessorial, strapsAccessorial, chainsAccessorial, deckHeightAccessorial, craneAccessorial, callBeforeArrivalAccessorial, dockRequiredAccessorial, lockedGateAccessorial, firstComeFirstServedAccessorial, appointmentRequiredAccessorial, whiteGloveAccessorial, hazmatAccessorial, excessiveLengthAccessorial, guaranteedServiceLevelAccessorial, otherAccessorial])).optional(), deliveryStopId: z.string().optional(), description: z.string().optional(), handlingUnits: z.union([handlingUnitsDetails, z.array(bookingHandlingUnit)]).optional(), items: z.array(item).optional(), identifiers: z.array(logisticsIdentifier).optional(), loadId: z.string().optional(), pickupStopId: z.string().optional()}); export const flatbedType = z.enum(["CONESTOGA", "DOUBLE_DROP"]); export const truckLoadPreferenceType = z.enum(["FULL", "PARTIAL"]); export const trailerType = z.enum(["FLATBED", "REFRIGERATED", "DRY_VAN", "VAN_CURTAINS", "MEGA", "TANKER", "LOWBOY", "JUMBO", "AUTO_CARRIER", "TRAILER", "VAN", "STRETCH_TRAILER", "CONTAINER"]); export const multiModalBookingServicePublicShippingDetailsOceanContainerType = z.enum(["TWENTY_FOOT", "FORTY_FOOT", "FORTY_FOOT_HIGH_CUBE", "FORTY_FOOT_OPEN_TOP", "FORTYFIVE_FOOT_HIGH_CUBE", "REEFER_TWENTY_FOOT", "REEFER_FORTY_FOOT", "REEFER_FORTY_FOOT_HIGH_CUBE"]); export const multiModalBookingServicePublicShippingDetailsTruckloadContainerType = z.object({containers: z.array(multiModalBookingServicePublicShippingDetailsOceanContainerType).optional()}); export const megaType = z.object({description: z.string().max(50).optional()}); export const refrigeratedClass = z.enum(["AMBIENT", "CHILLED", "FROZEN", "DEEP_FROZEN"]); export const refrigeratedTrailerDetails = z.object({refrigeratedClass: refrigeratedClass.optional()}); export const length = z.object({unit: lengthUnit.optional(), value: z.number().gte(0).optional()}); export const volume = z.object({unit: z.enum(["CUBIC_FT", "CUBIC_M", "L", "HL"]).optional(), value: z.number().optional()}); export const bookingTruckloadShippingDetails = z.object({accessorials: z.array(z.union([refrigeratedAccessorial, liftgateAccessorial, tarpsAccessorial, strapsAccessorial, chainsAccessorial, deckHeightAccessorial, craneAccessorial, callBeforeArrivalAccessorial, dockRequiredAccessorial, lockedGateAccessorial, firstComeFirstServedAccessorial, appointmentRequiredAccessorial, whiteGloveAccessorial, hazmatAccessorial, excessiveLengthAccessorial, guaranteedServiceLevelAccessorial, otherAccessorial])).optional(), flatbedType: flatbedType.optional(), loadPreference: truckLoadPreferenceType.optional(), trailerType: trailerType.optional(), trailerDetails: z.union([flatbedType, multiModalBookingServicePublicShippingDetailsTruckloadContainerType, megaType, refrigeratedTrailerDetails]).optional(), trailerLength: length.optional(), trailerVolume: volume.optional()}); export const oceanBookingType = z.enum(["LESS_THAN_CONTAINER_LOAD", "FULL_CONTAINER_LOAD", "ROLL_ON_ROLL_OFF", "OUT_OF_GAUGE"]); export const cargoMeasurements = z.object({dimensions: dimensions.optional(), volume: volume.optional(), weight: bookingWeight.optional()}); export const dryCargoContainerCount = z.object({fortyFootContainerCount: z.number().int().optional(), fortyFootHighCubeCount: z.number().int().optional(), fortyfiveFootHighCubeCount: z.number().int().optional(), fortyFootOpenTopCount: z.number().int().optional(), twentyFootContainerCount: z.number().int().optional()}); export const reeferContainerCount = z.object({fortyFootContainerCount: z.number().int().optional(), fortyFootHighCubeCount: z.number().int().optional(), twentyFootContainerCount: z.number().int().optional()}); export const fullContainerLoadContainerCount = z.object({dryCargoCount: dryCargoContainerCount.optional(), reeferCount: reeferContainerCount.optional()}); export const outOfGaugeContainerCount = z.object({fortyFootContainerCount: z.number().int().optional(), twentyFootContainerCount: z.number().int().optional()}); export const cutOffDetails = z.object({cutOffDatetime: z.string().optional(), documentationCutOffDatetime: z.string().optional(), vesselCutOffDatetime: z.string().optional()}); export const containerDetails = z.object({containerId: z.string().min(1).max(16).optional(), referenceKeys: z.array(customAttribute).optional()}); export const incotermType = z.enum(["EXW", "FCA", "FAS", "FOB", "CFR", "CIF", "CPT", "CIP", "DPU", "DAP", "DDP"]); export const codeListProvider = z.enum(["WAVE", "CARX", "ESSD", "IDT", "BOLE", "EDOX", "IQAX", "SECR", "TRGO", "ETEU", "TRAC", "BRIT", "GSBN", "WISE", "GLEIF", "W3C", "DNB", "FMC", "DCSA", "ZZZ"]); export const codeListName = z.enum(["DID", "LEI", "DUNS"]); export const identifyingCodes = z.object({codeListProvider: codeListProvider.optional(), codeListName: codeListName.optional(), partyCode: z.string().optional()}); export const partyType = z.enum(["SHIPPER", "CONSIGNEE", "BILL_TO", "NOTIFY_PARTY", "BOOKING_AGENT", "CARRIER_BOOKING_OFFICE"]); export const bookingParty = z.object({addressInfo: address.optional(), contactInfo: bookingContact.optional(), identifyingCodes: identifyingCodes.optional(), locationIdentifiers: z.array(bookingLocationIdentifier).optional(), partyType: partyType.optional(), vatNumber: z.string().optional()}); export const portType = z.enum(["PORT_OF_LOADING", "PORT_OF_DISCHARGE", "TRANSSHIPMENT_PORT"]); export const portDetails = z.object({estimatedDatetime: z.string().optional(), location: bookingLocation.optional(), portType: portType.optional()}); export const oceanServiceType = z.enum(["CONTAINER_YARD_TO_CONTAINER_YARD", "CONTAINER_YARD_TO_DOOR", "DOOR_TO_CONTAINER_YARD", "DOOR_TO_DOOR"]); export const oceanShippingDetails = z.object({accessorials: z.array(z.union([refrigeratedAccessorial, liftgateAccessorial, tarpsAccessorial, strapsAccessorial, chainsAccessorial, deckHeightAccessorial, craneAccessorial, callBeforeArrivalAccessorial, dockRequiredAccessorial, lockedGateAccessorial, firstComeFirstServedAccessorial, appointmentRequiredAccessorial, whiteGloveAccessorial, hazmatAccessorial, excessiveLengthAccessorial, guaranteedServiceLevelAccessorial, otherAccessorial])).optional(), bookingType: oceanBookingType.optional(), cargoMeasurements: cargoMeasurements.optional(), containerCount: z.union([fullContainerLoadContainerCount, outOfGaugeContainerCount]).optional(), cutOffDetails: cutOffDetails.optional(), containerDetails: z.array(containerDetails).optional(), estimatedFinalDestinationDatetime: z.string().optional(), incoterm: incotermType.optional(), parties: z.array(bookingParty).optional(), portsDetails: z.array(portDetails).optional(), serviceType: oceanServiceType.optional()}); export const airPortType = z.enum(["PORT_OF_LOADING", "PORT_OF_DISCHARGE", "TRANSSHIPMENT_PORT"]); export const airportDetails = z.object({estimatedArrivalDateTime: z.string().optional(), estimatedDepartureDateTime: z.string().optional(), location: bookingLocation.optional(), portType: airPortType.optional()}); export const airCargoMeasurements = z.object({dimensions: dimensions.optional(), volume: volume.optional(), weight: bookingWeight.optional()}); export const airIncotermType = z.enum(["EXW", "FCA", "FAS", "FOB", "CFR", "CIF", "CPT", "CIP", "DPU", "DAP", "DDP"]); export const airPaymentTerms = z.enum(["PREPAID", "COLLECT", "THIRD_PARTY"]); export const airServiceType = z.enum(["PORT_TO_PORT", "PORT_TO_DOOR", "DOOR_TO_PORT", "DOOR_TO_DOOR"]); export const airServiceLevel = z.enum(["EXPRESS", "STANDARD", "DEFERRED", "NEXT_FLIGHT_OUT"]); export const airShippingDetails = z.object({accessorials: z.array(z.union([refrigeratedAccessorial, liftgateAccessorial, tarpsAccessorial, strapsAccessorial, chainsAccessorial, deckHeightAccessorial, craneAccessorial, callBeforeArrivalAccessorial, dockRequiredAccessorial, lockedGateAccessorial, firstComeFirstServedAccessorial, appointmentRequiredAccessorial, whiteGloveAccessorial, hazmatAccessorial, excessiveLengthAccessorial, guaranteedServiceLevelAccessorial, otherAccessorial])).optional(), airportDetails: z.array(airportDetails).optional(), cargoMeasurements: airCargoMeasurements.optional(), estimatedFinalDestinationDateTime: z.string().optional(), incoterm: airIncotermType.optional(), parties: z.array(bookingParty).optional(), paymentTerms: airPaymentTerms.optional(), serviceType: airServiceType.optional(), serviceLevel: airServiceLevel.optional()}); export const bookingStatus = z.enum(["PROCESSING", "UNDER_REVIEW", "BOOKED", "REJECTED", "CANCELLED", "EXPIRED"]); export const transportationMode = z.enum(["OCEAN", "AIR", "RAIL", "TRUCKLOAD", "LTL", "VOLUME_LTL"]); export const booking = z.object({attributes: z.array(customAttribute).optional(), apiConfiguration: apiConfiguration.optional(), automatedFailureReason: automatedFailureReason.optional(), bookingSourceMethod: bookingSourceMethod.optional(), capacityProviderIdentifier: bookingCapacityProviderIdentifier.optional(), carrierContacts: z.array(bookingContact).optional(), charges: z.array(z.discriminatedUnion("code", [linehaulCharge, fuelSurchargeCharge, dropOffSurchargeCharge, accessorialCharge, otherCharge])).optional(), carrierResponseMethod: carrierResponseMethod.optional(), carrierRejectionNotes: z.string().max(300).optional(), carrierProvidedIdentifiers: z.array(logisticsIdentifier).optional(), capacityProviderReferenceKeys: z.array(customAttribute).optional(), createdDateTime: z.string().optional(), expirationDateTime: z.string().optional(), fuelSurchargeRate: monetaryValue.optional(), id: z.string().optional(), lastModifiedDateTime: z.string().optional(), lastAcceptedDateTime: z.string().optional(), masterShipmentId: z.string().optional(), notes: z.string().max(300).optional(), rateIdentifiers: z.array(rateIdentifier).optional(), routeSegmentIds: z.array(z.string()).optional(), rateRequestId: z.string().optional(), routeSegments: z.array(routeSegmentWithStops).optional(), rejectionReason: bookingRejectionReason.optional(), shipmentId: z.string().optional(), shipmentDetails: z.array(shipmentDetails).optional(), shipperContactInfo: bookingContact.optional(), shippingDetails: z.union([bookingTruckloadShippingDetails, oceanShippingDetails, airShippingDetails]).optional(), status: bookingStatus.optional(), shipmentIdentifiers: z.array(logisticsIdentifier).optional(), totalRate: monetaryValue.optional(), transportationMode: transportationMode.optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Flag Booking As Under Review * * POST /services/booking/v1/bookings/{bookingId}/carrier-notices */ export const createApiServicesBookingV1BookingsBookingIdCarrierNotices = async (args: CreateApiServicesBookingV1BookingsBookingIdCarrierNoticesArgs, options?: CreateApiServicesBookingV1BookingsBookingIdCarrierNoticesOptions) => { const {baseUrl = "https://na12.api.project44.com", fetch: fetchFn = fetch, oAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (oAuth2 !== undefined) headers.set('authorization', `Bearer ${oAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/services/booking/v1/bookings/${encodeURIComponent(String(args.bookingId))}/carrier-notices${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(booking, await res.json()) };