/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Alcohol, Alcohol$inboundSchema, Alcohol$Outbound, Alcohol$outboundSchema, } from "./alcohol.js"; import { Billing, Billing$inboundSchema, Billing$Outbound, Billing$outboundSchema, } from "./billing.js"; import { Cod, Cod$inboundSchema, Cod$Outbound, Cod$outboundSchema, } from "./cod.js"; import { CustomerReference, CustomerReference$inboundSchema, CustomerReference$Outbound, CustomerReference$outboundSchema, } from "./customerreference.js"; import { DangerousGoodsObject, DangerousGoodsObject$inboundSchema, DangerousGoodsObject$Outbound, DangerousGoodsObject$outboundSchema, } from "./dangerousgoodsobject.js"; import { DepartmentNumber, DepartmentNumber$inboundSchema, DepartmentNumber$Outbound, DepartmentNumber$outboundSchema, } from "./departmentnumber.js"; import { DryIce, DryIce$inboundSchema, DryIce$Outbound, DryIce$outboundSchema, } from "./dryice.js"; import { Insurance, Insurance$inboundSchema, Insurance$Outbound, Insurance$outboundSchema, } from "./insurance.js"; import { InvoiceNumber, InvoiceNumber$inboundSchema, InvoiceNumber$Outbound, InvoiceNumber$outboundSchema, } from "./invoicenumber.js"; import { PoNumber, PoNumber$inboundSchema, PoNumber$Outbound, PoNumber$outboundSchema, } from "./ponumber.js"; import { RmaNumber, RmaNumber$inboundSchema, RmaNumber$Outbound, RmaNumber$outboundSchema, } from "./rmanumber.js"; import { ShipmentExtraLasershipAttributesEnum, ShipmentExtraLasershipAttributesEnum$inboundSchema, ShipmentExtraLasershipAttributesEnum$outboundSchema, } from "./shipmentextralasershipattributesenum.js"; import { ShipmentExtraReturnServiceTypeLasershipEnum, ShipmentExtraReturnServiceTypeLasershipEnum$inboundSchema, ShipmentExtraReturnServiceTypeLasershipEnum$outboundSchema, } from "./shipmentextrareturnservicetypelasershipenum.js"; import { ShipmentExtraReturnServiceTypeUPSEnum, ShipmentExtraReturnServiceTypeUPSEnum$inboundSchema, ShipmentExtraReturnServiceTypeUPSEnum$outboundSchema, } from "./shipmentextrareturnservicetypeupsenum.js"; import { UPSReferenceFields, UPSReferenceFields$inboundSchema, UPSReferenceFields$Outbound, UPSReferenceFields$outboundSchema, } from "./upsreferencefields.js"; /** * Specify an ancillary service endorsement to provide the USPS with instructions on how to handle undeliverable-as-addressed pieces (DHL eCommerce only). */ export const AncillaryEndorsement = { ForwardingServiceRequested: "FORWARDING_SERVICE_REQUESTED", ReturnServiceRequested: "RETURN_SERVICE_REQUESTED", } as const; /** * Specify an ancillary service endorsement to provide the USPS with instructions on how to handle undeliverable-as-addressed pieces (DHL eCommerce only). */ export type AncillaryEndorsement = ClosedEnum; /** * Dangerous Goods Code (DHL eCommerce only). See Category Codes */ export const DangerousGoodsCode = { One: "01", Two: "02", Three: "03", Four: "04", Five: "05", Six: "06", Seven: "07", Eight: "08", Nine: "09", } as const; /** * Dangerous Goods Code (DHL eCommerce only). See Category Codes */ export type DangerousGoodsCode = ClosedEnum; /** * Required for DHL Germany Paket Sameday. Designates a desired timeframe for delivery. Format is `HHMMHHMM` */ export const PreferredDeliveryTimeframe = { TenMillionOneThousandTwoHundred: "10001200", TwelveMillionOneThousandFourHundred: "12001400", FourteenMillionOneThousandSixHundred: "14001600", SixteenMillionOneThousandEightHundred: "16001800", EighteenMillionTwoThousand: "18002000", NineteenMillionTwoThousandOneHundred: "19002100", } as const; /** * Required for DHL Germany Paket Sameday. Designates a desired timeframe for delivery. Format is `HHMMHHMM` */ export type PreferredDeliveryTimeframe = ClosedEnum< typeof PreferredDeliveryTimeframe >; /** * Request additional return option for return shipments (UPS and Lasership only). */ export type ReturnServiceType = | ShipmentExtraReturnServiceTypeUPSEnum | ShipmentExtraReturnServiceTypeLasershipEnum; /** * Request standard or adult signature confirmation. You can alternatively request Certified Mail (USPS only) * * @remarks * or Indirect signature (FedEx only) or Carrier Confirmation (Deutsche Post only). */ export const SignatureConfirmation = { Standard: "STANDARD", Adult: "ADULT", Certified: "CERTIFIED", Indirect: "INDIRECT", CarrierConfirmation: "CARRIER_CONFIRMATION", } as const; /** * Request standard or adult signature confirmation. You can alternatively request Certified Mail (USPS only) * * @remarks * or Indirect signature (FedEx only) or Carrier Confirmation (Deutsche Post only). */ export type SignatureConfirmation = ClosedEnum; /** * An object holding optional extra services to be requested. */ export type ShipmentExtra = { accountsReceivableCustomerAccount?: UPSReferenceFields | undefined; /** * Indicates that a shipment contains Alcohol (Fedex and UPS only). */ alcohol?: Alcohol | undefined; /** * Specify an ancillary service endorsement to provide the USPS with instructions on how to handle undeliverable-as-addressed pieces (DHL eCommerce only). */ ancillaryEndorsement?: AncillaryEndorsement | undefined; appropriationNumber?: UPSReferenceFields | undefined; /** * Request `true` to give carrier permission to leave the parcel in a safe place if no one answers the * * @remarks * door (where supported). When set to `false`, if no one is available to receive the item, the parcel * will not be left (*surcharges may be applicable). */ authorityToLeave?: boolean | undefined; billOfLadingNumber?: UPSReferenceFields | undefined; /** * Specify billing details (UPS, FedEx, and DHL Germany only). */ billing?: Billing | undefined; /** * Bypasses address validation (USPS, UPS, & LaserShip only). */ bypassAddressValidation?: boolean | undefined; /** * Request carbon offsets by passing true (UPS only). */ carbonNeutral?: boolean | undefined; /** * Identifies the carrier injection site. */ carrierHubId?: string | undefined; /** * Travel time in hours from fulfillment center to carrier injection site. */ carrierHubTravelTime?: number | undefined; /** * Specify collection on delivery details (UPS only). */ cod?: Cod | undefined; codNumber?: UPSReferenceFields | undefined; /** * Specify container type. */ containerType?: string | undefined; /** * Carrier arrival time to pickup packages from the fulfillment center. * * @remarks * UTC format: `%Y-%m-%dT%H:%M:%SZ` */ criticalPullTime?: string | undefined; /** * Specify customer branch (Lasership only). */ customerBranch?: string | undefined; /** * Specify the reference field on the label (FedEx and UPS only). */ customerReference?: CustomerReference | undefined; /** * Container for specifying the presence of dangerous materials. This is specific to USPS, and if any contents * * @remarks * are provided, only certain USPS service levels will be eligible. For more information, see our * guide on hazardous or dangerous materials shipping. */ dangerousGoods?: DangerousGoodsObject | undefined; /** * Dangerous Goods Code (DHL eCommerce only). See Category Codes */ dangerousGoodsCode?: DangerousGoodsCode | undefined; dealerOrderNumber?: UPSReferenceFields | undefined; /** * Specify delivery instructions. Up to 500 characters. (FedEx and OnTrac only). */ deliveryInstructions?: string | undefined; /** * Specify the department number field on the label (FedEx and UPS only). */ deptNumber?: DepartmentNumber | undefined; /** * Specify that the package contains Dry Ice (FedEx, Veho, and UPS only). */ dryIce?: DryIce | undefined; fdaProductCode?: UPSReferenceFields | undefined; /** * The fulfilment center where the package originates from. */ fulfillmentCenter?: string | undefined; /** * To add 3rd party insurance powered by XCover, * * @remarks * specify
`amount`, `content`, and `currency`.
Alternatively, you can choose carrier provided insurance * by additionally specifying `provider` (UPS, FedEx and OnTrac only).

If you do not want to add insurance * to your shipment, do not set these parameters. */ insurance?: Insurance | undefined; /** * Specify the invoice number field on the label (FedEx and UPS only). */ invoiceNumber?: InvoiceNumber | undefined; /** * This field specifies if it is a scan-based return shipment. See the Create a return shipment section for more details. */ isReturn?: boolean | undefined; /** * Specify Lasership Attributes (Lasership only). Multiple options accepted. */ lasershipAttrs?: Array | undefined; /** * Declared value (Lasership only). Defaults to `50.00`. */ lasershipDeclaredValue?: string | undefined; manifestNumber?: UPSReferenceFields | undefined; modelNumber?: UPSReferenceFields | undefined; partNumber?: UPSReferenceFields | undefined; /** * Specify the PO number field on the label (FedEx and UPS only). */ poNumber?: PoNumber | undefined; /** * Required for DHL Germany Paket Sameday. Designates a desired timeframe for delivery. Format is `HHMMHHMM` */ preferredDeliveryTimeframe?: PreferredDeliveryTimeframe | undefined; /** * Add premium service to a shipment (DHL Germany international shipments only). */ premium?: boolean | undefined; productionCode?: UPSReferenceFields | undefined; purchaseRequestNumber?: UPSReferenceFields | undefined; /** * Request a QR code for a given transaction when creating a shipping label (USPS domestic and Evri UK only). */ qrCodeRequested?: boolean | undefined; /** * Optional text to be printed on the shipping label if supported by carrier. Up to 50 characters. */ reference1?: string | undefined; /** * Optional text to be printed on the shipping label if supported by carrier. Up to 50 characters. For DHL eCommerce, this field can be used for billing reference. */ reference2?: string | undefined; /** * Returns retail rates instead of account-based rates (UPS and FedEx only). */ requestRetailRates?: boolean | undefined; /** * Request additional return option for return shipments (UPS and Lasership only). */ returnServiceType?: | ShipmentExtraReturnServiceTypeUPSEnum | ShipmentExtraReturnServiceTypeLasershipEnum | undefined; /** * Specify the RMA number field on the label (FedEx and UPS only). */ rmaNumber?: RmaNumber | undefined; /** * Marks shipment as to be delivered on a Saturday. */ saturdayDelivery?: boolean | undefined; salespersonNumber?: UPSReferenceFields | undefined; serialNumber?: UPSReferenceFields | undefined; /** * Request standard or adult signature confirmation. You can alternatively request Certified Mail (USPS only) * * @remarks * or Indirect signature (FedEx only) or Carrier Confirmation (Deutsche Post only). */ signatureConfirmation?: SignatureConfirmation | undefined; storeNumber?: UPSReferenceFields | undefined; transactionReferenceNumber?: UPSReferenceFields | undefined; /** * UPS only. Request USMCA (United States-Mexico-Canada Agreement) preferential tariff treatment. * * @remarks * When enabled, it includes the USMCA eligibility declaration in customs documentation. * * Supported routes and value limits: * - USA/Canada → Mexico: ≤ $1,000 USD * - Canada/Mexico → USA: ≤ $2,500 USD * - USA/Mexico → Canada: ≤ $3,300 CAD * * Only for declaration-only shipments, full USMCA - FormType 04 (Certificate of Origin) is not supported. */ usmcaEligible?: boolean | undefined; }; /** @internal */ export const AncillaryEndorsement$inboundSchema: z.ZodMiniEnum< typeof AncillaryEndorsement > = z.enum(AncillaryEndorsement); /** @internal */ export const AncillaryEndorsement$outboundSchema: z.ZodMiniEnum< typeof AncillaryEndorsement > = AncillaryEndorsement$inboundSchema; /** @internal */ export const DangerousGoodsCode$inboundSchema: z.ZodMiniEnum< typeof DangerousGoodsCode > = z.enum(DangerousGoodsCode); /** @internal */ export const DangerousGoodsCode$outboundSchema: z.ZodMiniEnum< typeof DangerousGoodsCode > = DangerousGoodsCode$inboundSchema; /** @internal */ export const PreferredDeliveryTimeframe$inboundSchema: z.ZodMiniEnum< typeof PreferredDeliveryTimeframe > = z.enum(PreferredDeliveryTimeframe); /** @internal */ export const PreferredDeliveryTimeframe$outboundSchema: z.ZodMiniEnum< typeof PreferredDeliveryTimeframe > = PreferredDeliveryTimeframe$inboundSchema; /** @internal */ export const ReturnServiceType$inboundSchema: z.ZodMiniType< ReturnServiceType, unknown > = z.union([ ShipmentExtraReturnServiceTypeUPSEnum$inboundSchema, ShipmentExtraReturnServiceTypeLasershipEnum$inboundSchema, ]); /** @internal */ export type ReturnServiceType$Outbound = string | string; /** @internal */ export const ReturnServiceType$outboundSchema: z.ZodMiniType< ReturnServiceType$Outbound, ReturnServiceType > = z.union([ ShipmentExtraReturnServiceTypeUPSEnum$outboundSchema, ShipmentExtraReturnServiceTypeLasershipEnum$outboundSchema, ]); export function returnServiceTypeToJSON( returnServiceType: ReturnServiceType, ): string { return JSON.stringify( ReturnServiceType$outboundSchema.parse(returnServiceType), ); } export function returnServiceTypeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReturnServiceType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReturnServiceType' from JSON`, ); } /** @internal */ export const SignatureConfirmation$inboundSchema: z.ZodMiniEnum< typeof SignatureConfirmation > = z.enum(SignatureConfirmation); /** @internal */ export const SignatureConfirmation$outboundSchema: z.ZodMiniEnum< typeof SignatureConfirmation > = SignatureConfirmation$inboundSchema; /** @internal */ export const ShipmentExtra$inboundSchema: z.ZodMiniType< ShipmentExtra, unknown > = z.pipe( z.object({ accounts_receivable_customer_account: z.optional( UPSReferenceFields$inboundSchema, ), alcohol: z.optional(Alcohol$inboundSchema), ancillary_endorsement: z.optional(AncillaryEndorsement$inboundSchema), appropriation_number: z.optional(UPSReferenceFields$inboundSchema), authority_to_leave: z.optional(z.boolean()), bill_of_lading_number: z.optional(UPSReferenceFields$inboundSchema), billing: z.optional(Billing$inboundSchema), bypass_address_validation: z.optional(z.boolean()), carbon_neutral: z.optional(z.boolean()), carrier_hub_id: z.optional(z.string()), carrier_hub_travel_time: z.optional(z.int()), COD: z.optional(Cod$inboundSchema), cod_number: z.optional(UPSReferenceFields$inboundSchema), container_type: z.optional(z.string()), critical_pull_time: z.optional(z.string()), customer_branch: z.optional(z.string()), customer_reference: z.optional(CustomerReference$inboundSchema), dangerous_goods: z.optional(DangerousGoodsObject$inboundSchema), dangerous_goods_code: z.optional(DangerousGoodsCode$inboundSchema), dealer_order_number: z.optional(UPSReferenceFields$inboundSchema), delivery_instructions: z.optional(z.string()), dept_number: z.optional(DepartmentNumber$inboundSchema), dry_ice: z.optional(DryIce$inboundSchema), fda_product_code: z.optional(UPSReferenceFields$inboundSchema), fulfillment_center: z.optional(z.string()), insurance: z.optional(Insurance$inboundSchema), invoice_number: z.optional(InvoiceNumber$inboundSchema), is_return: z.optional(z.boolean()), lasership_attrs: z.optional( z.array(ShipmentExtraLasershipAttributesEnum$inboundSchema), ), lasership_declared_value: z.optional(z.string()), manifest_number: z.optional(UPSReferenceFields$inboundSchema), model_number: z.optional(UPSReferenceFields$inboundSchema), part_number: z.optional(UPSReferenceFields$inboundSchema), po_number: z.optional(PoNumber$inboundSchema), preferred_delivery_timeframe: z.optional( PreferredDeliveryTimeframe$inboundSchema, ), premium: z.optional(z.boolean()), production_code: z.optional(UPSReferenceFields$inboundSchema), purchase_request_number: z.optional(UPSReferenceFields$inboundSchema), qr_code_requested: z.optional(z.boolean()), reference_1: z.optional(z.string()), reference_2: z.optional(z.string()), request_retail_rates: z.optional(z.boolean()), return_service_type: z.optional( z.union([ ShipmentExtraReturnServiceTypeUPSEnum$inboundSchema, ShipmentExtraReturnServiceTypeLasershipEnum$inboundSchema, ]), ), rma_number: z.optional(RmaNumber$inboundSchema), saturday_delivery: z.optional(z.boolean()), salesperson_number: z.optional(UPSReferenceFields$inboundSchema), serial_number: z.optional(UPSReferenceFields$inboundSchema), signature_confirmation: z.optional(SignatureConfirmation$inboundSchema), store_number: z.optional(UPSReferenceFields$inboundSchema), transaction_reference_number: z.optional(UPSReferenceFields$inboundSchema), usmca_eligible: z.optional(z.boolean()), }), z.transform((v) => { return remap$(v, { "accounts_receivable_customer_account": "accountsReceivableCustomerAccount", "ancillary_endorsement": "ancillaryEndorsement", "appropriation_number": "appropriationNumber", "authority_to_leave": "authorityToLeave", "bill_of_lading_number": "billOfLadingNumber", "bypass_address_validation": "bypassAddressValidation", "carbon_neutral": "carbonNeutral", "carrier_hub_id": "carrierHubId", "carrier_hub_travel_time": "carrierHubTravelTime", "COD": "cod", "cod_number": "codNumber", "container_type": "containerType", "critical_pull_time": "criticalPullTime", "customer_branch": "customerBranch", "customer_reference": "customerReference", "dangerous_goods": "dangerousGoods", "dangerous_goods_code": "dangerousGoodsCode", "dealer_order_number": "dealerOrderNumber", "delivery_instructions": "deliveryInstructions", "dept_number": "deptNumber", "dry_ice": "dryIce", "fda_product_code": "fdaProductCode", "fulfillment_center": "fulfillmentCenter", "invoice_number": "invoiceNumber", "is_return": "isReturn", "lasership_attrs": "lasershipAttrs", "lasership_declared_value": "lasershipDeclaredValue", "manifest_number": "manifestNumber", "model_number": "modelNumber", "part_number": "partNumber", "po_number": "poNumber", "preferred_delivery_timeframe": "preferredDeliveryTimeframe", "production_code": "productionCode", "purchase_request_number": "purchaseRequestNumber", "qr_code_requested": "qrCodeRequested", "reference_1": "reference1", "reference_2": "reference2", "request_retail_rates": "requestRetailRates", "return_service_type": "returnServiceType", "rma_number": "rmaNumber", "saturday_delivery": "saturdayDelivery", "salesperson_number": "salespersonNumber", "serial_number": "serialNumber", "signature_confirmation": "signatureConfirmation", "store_number": "storeNumber", "transaction_reference_number": "transactionReferenceNumber", "usmca_eligible": "usmcaEligible", }); }), ); /** @internal */ export type ShipmentExtra$Outbound = { accounts_receivable_customer_account?: | UPSReferenceFields$Outbound | undefined; alcohol?: Alcohol$Outbound | undefined; ancillary_endorsement?: string | undefined; appropriation_number?: UPSReferenceFields$Outbound | undefined; authority_to_leave?: boolean | undefined; bill_of_lading_number?: UPSReferenceFields$Outbound | undefined; billing?: Billing$Outbound | undefined; bypass_address_validation?: boolean | undefined; carbon_neutral?: boolean | undefined; carrier_hub_id?: string | undefined; carrier_hub_travel_time?: number | undefined; COD?: Cod$Outbound | undefined; cod_number?: UPSReferenceFields$Outbound | undefined; container_type?: string | undefined; critical_pull_time?: string | undefined; customer_branch?: string | undefined; customer_reference?: CustomerReference$Outbound | undefined; dangerous_goods?: DangerousGoodsObject$Outbound | undefined; dangerous_goods_code?: string | undefined; dealer_order_number?: UPSReferenceFields$Outbound | undefined; delivery_instructions?: string | undefined; dept_number?: DepartmentNumber$Outbound | undefined; dry_ice?: DryIce$Outbound | undefined; fda_product_code?: UPSReferenceFields$Outbound | undefined; fulfillment_center?: string | undefined; insurance?: Insurance$Outbound | undefined; invoice_number?: InvoiceNumber$Outbound | undefined; is_return?: boolean | undefined; lasership_attrs?: Array | undefined; lasership_declared_value?: string | undefined; manifest_number?: UPSReferenceFields$Outbound | undefined; model_number?: UPSReferenceFields$Outbound | undefined; part_number?: UPSReferenceFields$Outbound | undefined; po_number?: PoNumber$Outbound | undefined; preferred_delivery_timeframe?: string | undefined; premium?: boolean | undefined; production_code?: UPSReferenceFields$Outbound | undefined; purchase_request_number?: UPSReferenceFields$Outbound | undefined; qr_code_requested?: boolean | undefined; reference_1?: string | undefined; reference_2?: string | undefined; request_retail_rates?: boolean | undefined; return_service_type?: string | string | undefined; rma_number?: RmaNumber$Outbound | undefined; saturday_delivery?: boolean | undefined; salesperson_number?: UPSReferenceFields$Outbound | undefined; serial_number?: UPSReferenceFields$Outbound | undefined; signature_confirmation?: string | undefined; store_number?: UPSReferenceFields$Outbound | undefined; transaction_reference_number?: UPSReferenceFields$Outbound | undefined; usmca_eligible?: boolean | undefined; }; /** @internal */ export const ShipmentExtra$outboundSchema: z.ZodMiniType< ShipmentExtra$Outbound, ShipmentExtra > = z.pipe( z.object({ accountsReceivableCustomerAccount: z.optional( UPSReferenceFields$outboundSchema, ), alcohol: z.optional(Alcohol$outboundSchema), ancillaryEndorsement: z.optional(AncillaryEndorsement$outboundSchema), appropriationNumber: z.optional(UPSReferenceFields$outboundSchema), authorityToLeave: z.optional(z.boolean()), billOfLadingNumber: z.optional(UPSReferenceFields$outboundSchema), billing: z.optional(Billing$outboundSchema), bypassAddressValidation: z.optional(z.boolean()), carbonNeutral: z.optional(z.boolean()), carrierHubId: z.optional(z.string()), carrierHubTravelTime: z.optional(z.int()), cod: z.optional(Cod$outboundSchema), codNumber: z.optional(UPSReferenceFields$outboundSchema), containerType: z.optional(z.string()), criticalPullTime: z.optional(z.string()), customerBranch: z.optional(z.string()), customerReference: z.optional(CustomerReference$outboundSchema), dangerousGoods: z.optional(DangerousGoodsObject$outboundSchema), dangerousGoodsCode: z.optional(DangerousGoodsCode$outboundSchema), dealerOrderNumber: z.optional(UPSReferenceFields$outboundSchema), deliveryInstructions: z.optional(z.string()), deptNumber: z.optional(DepartmentNumber$outboundSchema), dryIce: z.optional(DryIce$outboundSchema), fdaProductCode: z.optional(UPSReferenceFields$outboundSchema), fulfillmentCenter: z.optional(z.string()), insurance: z.optional(Insurance$outboundSchema), invoiceNumber: z.optional(InvoiceNumber$outboundSchema), isReturn: z.optional(z.boolean()), lasershipAttrs: z.optional( z.array(ShipmentExtraLasershipAttributesEnum$outboundSchema), ), lasershipDeclaredValue: z.optional(z.string()), manifestNumber: z.optional(UPSReferenceFields$outboundSchema), modelNumber: z.optional(UPSReferenceFields$outboundSchema), partNumber: z.optional(UPSReferenceFields$outboundSchema), poNumber: z.optional(PoNumber$outboundSchema), preferredDeliveryTimeframe: z.optional( PreferredDeliveryTimeframe$outboundSchema, ), premium: z.optional(z.boolean()), productionCode: z.optional(UPSReferenceFields$outboundSchema), purchaseRequestNumber: z.optional(UPSReferenceFields$outboundSchema), qrCodeRequested: z.optional(z.boolean()), reference1: z.optional(z.string()), reference2: z.optional(z.string()), requestRetailRates: z.optional(z.boolean()), returnServiceType: z.optional( z.union([ ShipmentExtraReturnServiceTypeUPSEnum$outboundSchema, ShipmentExtraReturnServiceTypeLasershipEnum$outboundSchema, ]), ), rmaNumber: z.optional(RmaNumber$outboundSchema), saturdayDelivery: z.optional(z.boolean()), salespersonNumber: z.optional(UPSReferenceFields$outboundSchema), serialNumber: z.optional(UPSReferenceFields$outboundSchema), signatureConfirmation: z.optional(SignatureConfirmation$outboundSchema), storeNumber: z.optional(UPSReferenceFields$outboundSchema), transactionReferenceNumber: z.optional(UPSReferenceFields$outboundSchema), usmcaEligible: z.optional(z.boolean()), }), z.transform((v) => { return remap$(v, { accountsReceivableCustomerAccount: "accounts_receivable_customer_account", ancillaryEndorsement: "ancillary_endorsement", appropriationNumber: "appropriation_number", authorityToLeave: "authority_to_leave", billOfLadingNumber: "bill_of_lading_number", bypassAddressValidation: "bypass_address_validation", carbonNeutral: "carbon_neutral", carrierHubId: "carrier_hub_id", carrierHubTravelTime: "carrier_hub_travel_time", cod: "COD", codNumber: "cod_number", containerType: "container_type", criticalPullTime: "critical_pull_time", customerBranch: "customer_branch", customerReference: "customer_reference", dangerousGoods: "dangerous_goods", dangerousGoodsCode: "dangerous_goods_code", dealerOrderNumber: "dealer_order_number", deliveryInstructions: "delivery_instructions", deptNumber: "dept_number", dryIce: "dry_ice", fdaProductCode: "fda_product_code", fulfillmentCenter: "fulfillment_center", invoiceNumber: "invoice_number", isReturn: "is_return", lasershipAttrs: "lasership_attrs", lasershipDeclaredValue: "lasership_declared_value", manifestNumber: "manifest_number", modelNumber: "model_number", partNumber: "part_number", poNumber: "po_number", preferredDeliveryTimeframe: "preferred_delivery_timeframe", productionCode: "production_code", purchaseRequestNumber: "purchase_request_number", qrCodeRequested: "qr_code_requested", reference1: "reference_1", reference2: "reference_2", requestRetailRates: "request_retail_rates", returnServiceType: "return_service_type", rmaNumber: "rma_number", saturdayDelivery: "saturday_delivery", salespersonNumber: "salesperson_number", serialNumber: "serial_number", signatureConfirmation: "signature_confirmation", storeNumber: "store_number", transactionReferenceNumber: "transaction_reference_number", usmcaEligible: "usmca_eligible", }); }), ); export function shipmentExtraToJSON(shipmentExtra: ShipmentExtra): string { return JSON.stringify(ShipmentExtra$outboundSchema.parse(shipmentExtra)); } export function shipmentExtraFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ShipmentExtra$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ShipmentExtra' from JSON`, ); }