/*
* 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";
/**
* Object that represents the address of the importer
*/
export type AddressImporter = {
/**
* First and Last Name of the addressee
*/
name?: string | undefined;
/**
* Company Name
*/
company?: string | undefined;
/**
* First street line, 35 character limit. Usually street number and street name (except for DHL Germany, see street_no).
*/
street1?: string | undefined;
/**
* Second street line, 35 character limit.
*/
street2?: string | undefined;
/**
* Third street line, 35 character limit.
*
* @remarks
* Only accepted for USPS international shipments, UPS domestic and UPS international shipments.
*/
street3?: string | undefined;
/**
* Street number of the addressed building.
*
* @remarks
* This field can be included in street1 for all carriers except for DHL Germany.
*/
streetNo?: string | undefined;
/**
* Name of a city
*/
city?: string | undefined;
/**
* **required for purchase for some countries**
*
* @remarks
* State/Province values are required for shipments from/to the US, AU, and CA. UPS requires province for some
* countries (i.e Ireland). To receive more accurate quotes, passing this field is recommended. Most carriers
* only accept two or three character state abbreviations.
*/
state?: string | undefined;
/**
* Postal code of an Address.
*/
zip?: string | undefined;
/**
* Example: `US` or `DE`. All accepted values can be found on the
*
* @remarks
* Official ISO Website.
* Sending a country is always required.
*/
country?: string | undefined;
/**
* Addresses containing a phone number allow carriers to call the recipient when delivering the Parcel. This
*
* @remarks
* increases the probability of delivery and helps to avoid accessorial charges after a Parcel has been shipped.
*/
phone?: string | undefined;
/**
* E-mail address of the contact person, RFC3696/5321-compliant.
*/
email?: string | undefined;
/**
* Indicates whether the address provided is a residential address or not.
*/
isResidential?: boolean | undefined;
};
/** @internal */
export type AddressImporter$Outbound = {
name?: string | undefined;
company?: string | undefined;
street1?: string | undefined;
street2?: string | undefined;
street3?: string | undefined;
street_no?: string | undefined;
city?: string | undefined;
state?: string | undefined;
zip?: string | undefined;
country?: string | undefined;
phone?: string | undefined;
email?: string | undefined;
is_residential?: boolean | undefined;
};
/** @internal */
export const AddressImporter$outboundSchema: z.ZodMiniType<
AddressImporter$Outbound,
AddressImporter
> = z.pipe(
z.object({
name: z.optional(z.string()),
company: z.optional(z.string()),
street1: z.optional(z.string()),
street2: z.optional(z.string()),
street3: z.optional(z.string()),
streetNo: z.optional(z.string()),
city: z.optional(z.string()),
state: z.optional(z.string()),
zip: z.optional(z.string()),
country: z.optional(z.string()),
phone: z.optional(z.string()),
email: z.optional(z.string()),
isResidential: z.optional(z.boolean()),
}),
z.transform((v) => {
return remap$(v, {
streetNo: "street_no",
isResidential: "is_residential",
});
}),
);
export function addressImporterToJSON(
addressImporter: AddressImporter,
): string {
return JSON.stringify(AddressImporter$outboundSchema.parse(addressImporter));
}